mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 11:55:30 +00:00
Improved debugger display.
This commit is contained in:
parent
315121e149
commit
3cb801a5df
@ -40,10 +40,17 @@ struct CommandLineDebugger
|
||||
}
|
||||
|
||||
if (force_to_break) {
|
||||
static auto show_initial_usage = true;
|
||||
if (show_initial_usage) {
|
||||
show_initial_usage = false;
|
||||
usage();
|
||||
}
|
||||
|
||||
show_lines(ast);
|
||||
|
||||
for (;;) {
|
||||
cout << "debug> ";
|
||||
cout << endl << "debug> ";
|
||||
|
||||
string s;
|
||||
std::getline(cin, s);
|
||||
|
||||
@ -51,7 +58,7 @@ struct CommandLineDebugger
|
||||
is >> command_;
|
||||
|
||||
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") {
|
||||
is >> display_lines_;
|
||||
show_lines(ast);
|
||||
@ -79,7 +86,7 @@ struct CommandLineDebugger
|
||||
void show_lines(const Ast& ast) {
|
||||
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);
|
||||
|
||||
@ -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;
|
||||
string command_;
|
||||
size_t level_ = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user