diff options
Diffstat (limited to 'tdbg.cpp')
| -rw-r--r-- | tdbg.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
| @@ -672,6 +672,7 @@ void draw_status_bar(SBProcess &process, InputMode mode, int width, int height) | |||
| 672 | 672 | ||
| 673 | int main(int argc, char** argv) { | 673 | int main(int argc, char** argv) { |
| 674 | std::vector<std::string> target_env; | 674 | std::vector<std::string> target_env; |
| 675 | std::vector<std::string> startup_breakpoints; | ||
| 675 | std::vector<std::string> debuggee_args; | 676 | std::vector<std::string> debuggee_args; |
| 676 | std::string target_path; | 677 | std::string target_path; |
| 677 | 678 | ||
| @@ -679,6 +680,8 @@ int main(int argc, char** argv) { | |||
| 679 | std::string arg = argv[i]; | 680 | std::string arg = argv[i]; |
| 680 | if (arg == "-e" && i + 1 < argc) { | 681 | if (arg == "-e" && i + 1 < argc) { |
| 681 | target_env.push_back(argv[++i]); | 682 | target_env.push_back(argv[++i]); |
| 683 | } else if (arg == "-b" && i + 1 < argc) { | ||
| 684 | startup_breakpoints.push_back(argv[++i]); | ||
| 682 | } else if (arg == "--") { | 685 | } else if (arg == "--") { |
| 683 | for (int j = i + 1; j < argc; ++j) { | 686 | for (int j = i + 1; j < argc; ++j) { |
| 684 | debuggee_args.push_back(argv[j]); | 687 | debuggee_args.push_back(argv[j]); |
| @@ -692,7 +695,7 @@ int main(int argc, char** argv) { | |||
| 692 | } | 695 | } |
| 693 | 696 | ||
| 694 | if (target_path.empty()) { | 697 | if (target_path.empty()) { |
| 695 | std::cerr << "Usage: " << argv[0] << " [-e KEY=VALUE] ... <target_executable> [-- arg1 arg2 ...]\n"; | 698 | std::cerr << "Usage: " << argv[0] << " [-e KEY=VALUE] [-b BREAKPOINT] ... <target_executable> [-- arg1 arg2 ...]\n"; |
| 696 | return 1; | 699 | return 1; |
| 697 | } | 700 | } |
| 698 | 701 | ||
| @@ -712,6 +715,16 @@ int main(int argc, char** argv) { | |||
| 712 | return 1; | 715 | return 1; |
| 713 | } | 716 | } |
| 714 | 717 | ||
| 718 | std::vector<std::string> log_buffer; | ||
| 719 | for (const auto& bp_spec : startup_breakpoints) { | ||
| 720 | SBBreakpoint bp = create_breakpoint(target, bp_spec); | ||
| 721 | if (bp.IsValid() && bp.GetNumLocations() > 0) { | ||
| 722 | log_msg(log_buffer, "Set startup breakpoint: " + bp_spec); | ||
| 723 | } else { | ||
| 724 | log_msg(log_buffer, "Failed to set startup breakpoint: " + bp_spec); | ||
| 725 | } | ||
| 726 | } | ||
| 727 | |||
| 715 | SBProcess process; | 728 | SBProcess process; |
| 716 | SBThread thread; | 729 | SBThread thread; |
| 717 | 730 | ||
| @@ -721,7 +734,6 @@ int main(int argc, char** argv) { | |||
| 721 | InputMode mode = INPUT_MODE_NORMAL; | 734 | InputMode mode = INPUT_MODE_NORMAL; |
| 722 | std::string input_buffer; | 735 | std::string input_buffer; |
| 723 | std::string current_source_filename; | 736 | std::string current_source_filename; |
| 724 | std::vector<std::string> log_buffer; | ||
| 725 | std::vector<std::string> watch_expressions; | 737 | std::vector<std::string> watch_expressions; |
| 726 | int log_scroll_offset = 0; | 738 | int log_scroll_offset = 0; |
| 727 | int locals_scroll_offset = 0; | 739 | int locals_scroll_offset = 0; |
