|
|
@ -40,10 +40,17 @@ struct CommandLineDebugger |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (force_to_break) { |
|
|
|
if (force_to_break) { |
|
|
|
|
|
|
|
static auto show_initial_usage = true; |
|
|
|
|
|
|
|
if (show_initial_usage) { |
|
|
|
|
|
|
|
show_initial_usage = false; |
|
|
|
|
|
|
|
usage(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
show_lines(ast); |
|
|
|
show_lines(ast); |
|
|
|
|
|
|
|
|
|
|
|
for (;;) { |
|
|
|
for (;;) { |
|
|
|
cout << "debug> "; |
|
|
|
cout << endl << "debug> "; |
|
|
|
|
|
|
|
|
|
|
|
string s; |
|
|
|
string s; |
|
|
|
std::getline(cin, s); |
|
|
|
std::getline(cin, s); |
|
|
|
|
|
|
|
|
|
|
@ -51,7 +58,7 @@ struct CommandLineDebugger |
|
|
|
is >> command_; |
|
|
|
is >> command_; |
|
|
|
|
|
|
|
|
|
|
|
if (command_ == "h") { |
|
|
|
if (command_ == "h") { |
|
|
|
cout << "(c)ontinue, (n)ext, (s)tep in, step (o)out, (p)ring, (l)ist, (q)uit" << endl; |
|
|
|
usage(); |
|
|
|
} else if (command_ == "l") { |
|
|
|
} else if (command_ == "l") { |
|
|
|
is >> display_lines_; |
|
|
|
is >> display_lines_; |
|
|
|
show_lines(ast); |
|
|
|
show_lines(ast); |
|
|
@ -79,7 +86,7 @@ struct CommandLineDebugger |
|
|
|
void show_lines(const Ast& ast) { |
|
|
|
void show_lines(const Ast& ast) { |
|
|
|
prepare_cache(ast.path); |
|
|
|
prepare_cache(ast.path); |
|
|
|
|
|
|
|
|
|
|
|
cout << "break in " << ast.path << ":" << ast.line << endl; |
|
|
|
cout << endl << "Break in " << ast.path << ":" << ast.line << endl; |
|
|
|
|
|
|
|
|
|
|
|
auto count = get_line_count(ast.path); |
|
|
|
auto count = get_line_count(ast.path); |
|
|
|
|
|
|
|
|
|
|
@ -194,6 +201,10 @@ struct CommandLineDebugger |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void usage() { |
|
|
|
|
|
|
|
cout << "Usage: (c)ontinue, (n)ext, (s)tep in, step (o)out, (p)ring, (l)ist, (q)uit" << endl; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool quit = false; |
|
|
|
bool quit = false; |
|
|
|
string command_; |
|
|
|
string command_; |
|
|
|
size_t level_ = 0; |
|
|
|
size_t level_ = 0; |
|
|
|