diff options
Diffstat (limited to 'source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r-- | source/Commands/CommandObjectBreakpoint.cpp | 108 |
1 files changed, 86 insertions, 22 deletions
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp index 025524b..4cbcb70 100644 --- a/source/Commands/CommandObjectBreakpoint.cpp +++ b/source/Commands/CommandObjectBreakpoint.cpp @@ -7,8 +7,6 @@ // //===----------------------------------------------------------------------===// -#include "lldb/lldb-python.h" - #include "CommandObjectBreakpoint.h" #include "CommandObjectBreakpointCommand.h" @@ -21,12 +19,14 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Interpreter/OptionValueBoolean.h" #include "lldb/Interpreter/OptionValueString.h" #include "lldb/Interpreter/OptionValueUInt64.h" #include "lldb/Core/RegularExpression.h" #include "lldb/Core/StreamString.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Target.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Target/StackFrame.h" @@ -110,9 +110,11 @@ public: m_catch_bp (false), m_throw_bp (true), m_hardware (false), - m_language (eLanguageTypeUnknown), + m_exception_language (eLanguageTypeUnknown), m_skip_prologue (eLazyBoolCalculate), - m_one_shot (false) + m_one_shot (false), + m_all_files (false), + m_move_to_nearest_code (eLazyBoolCalculate) { } @@ -135,15 +137,23 @@ public: } break; + case 'A': + m_all_files = true; + break; + case 'b': m_func_names.push_back (option_arg); m_func_name_type_mask |= eFunctionNameTypeBase; break; case 'C': - m_column = StringConvert::ToUInt32 (option_arg, 0); + { + bool success; + m_column = StringConvert::ToUInt32 (option_arg, 0, 0, &success); + if (!success) + error.SetErrorStringWithFormat("invalid column number: %s", option_arg); break; - + } case 'c': m_condition.assign(option_arg); break; @@ -162,16 +172,16 @@ public: case eLanguageTypeC: case eLanguageTypeC99: case eLanguageTypeC11: - m_language = eLanguageTypeC; + m_exception_language = eLanguageTypeC; break; case eLanguageTypeC_plus_plus: case eLanguageTypeC_plus_plus_03: case eLanguageTypeC_plus_plus_11: case eLanguageTypeC_plus_plus_14: - m_language = eLanguageTypeC_plus_plus; + m_exception_language = eLanguageTypeC_plus_plus; break; case eLanguageTypeObjC: - m_language = eLanguageTypeObjC; + m_exception_language = eLanguageTypeObjC; break; case eLanguageTypeObjC_plus_plus: error.SetErrorStringWithFormat ("Set exception breakpoints separately for c++ and objective-c"); @@ -231,8 +241,28 @@ public: break; case 'l': - m_line_num = StringConvert::ToUInt32 (option_arg, 0); + { + bool success; + m_line_num = StringConvert::ToUInt32 (option_arg, 0, 0, &success); + if (!success) + error.SetErrorStringWithFormat ("invalid line number: %s.", option_arg); + break; + } + + case 'm': + { + bool success; + bool value; + value = Args::StringToBoolean (option_arg, true, &success); + if (value) + m_move_to_nearest_code = eLazyBoolYes; + else + m_move_to_nearest_code = eLazyBoolNo; + + if (!success) + error.SetErrorStringWithFormat ("Invalid boolean value for move-to-nearest-code option: '%s'", option_arg); break; + } case 'M': m_func_names.push_back (option_arg); @@ -253,6 +283,11 @@ public: m_one_shot = true; break; + case 'O': + m_exception_extra_args.AppendArgument ("-O"); + m_exception_extra_args.AppendArgument (option_arg); + break; + case 'p': m_source_text_regexp.assign (option_arg); break; @@ -334,11 +369,14 @@ public: m_catch_bp = false; m_throw_bp = true; m_hardware = false; - m_language = eLanguageTypeUnknown; + m_exception_language = eLanguageTypeUnknown; m_skip_prologue = eLazyBoolCalculate; m_one_shot = false; m_use_dummy = false; m_breakpoint_names.clear(); + m_all_files = false; + m_exception_extra_args.Clear(); + m_move_to_nearest_code = eLazyBoolCalculate; } const OptionDefinition* @@ -372,10 +410,13 @@ public: bool m_catch_bp; bool m_throw_bp; bool m_hardware; // Request to use hardware breakpoints - lldb::LanguageType m_language; + lldb::LanguageType m_exception_language; LazyBool m_skip_prologue; bool m_one_shot; bool m_use_dummy; + bool m_all_files; + Args m_exception_extra_args; + LazyBool m_move_to_nearest_code; }; @@ -413,7 +454,7 @@ protected: break_type = eSetTypeFunctionRegexp; else if (!m_options.m_source_text_regexp.empty()) break_type = eSetTypeSourceRegexp; - else if (m_options.m_language != eLanguageTypeUnknown) + else if (m_options.m_exception_language != eLanguageTypeUnknown) break_type = eSetTypeException; Breakpoint *bp = NULL; @@ -453,7 +494,8 @@ protected: check_inlines, m_options.m_skip_prologue, internal, - m_options.m_hardware).get(); + m_options.m_hardware, + m_options.m_move_to_nearest_code).get(); } break; @@ -505,7 +547,7 @@ protected: { const size_t num_files = m_options.m_filenames.GetSize(); - if (num_files == 0) + if (num_files == 0 && !m_options.m_all_files) { FileSpec file; if (!GetDefaultFile (target, file, result)) @@ -534,15 +576,27 @@ protected: &(m_options.m_filenames), regexp, internal, - m_options.m_hardware).get(); + m_options.m_hardware, + m_options.m_move_to_nearest_code).get(); } break; case eSetTypeException: { - bp = target->CreateExceptionBreakpoint (m_options.m_language, + Error precond_error; + bp = target->CreateExceptionBreakpoint (m_options.m_exception_language, m_options.m_catch_bp, m_options.m_throw_bp, - m_options.m_hardware).get(); + internal, + &m_options.m_exception_extra_args, + &precond_error).get(); + if (precond_error.Fail()) + { + result.AppendErrorWithFormat("Error setting extra exception arguments: %s", + precond_error.AsCString()); + target->RemoveBreakpointByID(bp->GetID()); + result.SetStatus(eReturnStatusFailed); + return false; + } } break; default: @@ -654,6 +708,7 @@ private: #define LLDB_OPT_FILE ( LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2 ) #define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10 ) #define LLDB_OPT_SKIP_PROLOGUE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) ) +#define LLDB_OPT_MOVE_TO_NEAREST_CODE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_9 ) OptionDefinition CommandObjectBreakpointSet::CommandOptions::g_option_table[] = @@ -729,6 +784,9 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] = "specified with the -f option. The -f option can be specified more than once. " "If no source files are specified, uses the current \"default source file\"" }, + { LLDB_OPT_SET_9, false, "all-files", 'A', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, + "All files are searched for source pattern matches." }, + { LLDB_OPT_SET_10, true, "language-exception", 'E', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLanguage, "Set the breakpoint on exceptions thrown by the specified language (without options, on throw but not catch.)" }, @@ -738,6 +796,10 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] = { LLDB_OPT_SET_10, false, "on-catch", 'h', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "Set the breakpoint on exception catcH." }, +// Don't add this option till it actually does something useful... +// { LLDB_OPT_SET_10, false, "exception-typename", 'O', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeTypeName, +// "The breakpoint will only stop if an exception Object of this type is thrown. Can be repeated multiple times to stop for multiple object types" }, + { LLDB_OPT_SKIP_PROLOGUE, false, "skip-prologue", 'K', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, "sKip the prologue if the breakpoint is at the beginning of a function. If not set the target.skip-prologue setting is used." }, @@ -747,6 +809,9 @@ CommandObjectBreakpointSet::CommandOptions::g_option_table[] = { LLDB_OPT_SET_ALL, false, "breakpoint-name", 'N', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBreakpointName, "Adds this to the list of names for this breakopint."}, + { LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeBoolean, + "Move breakpoints to nearest code. If not set the target.move-to-nearest-code setting is used." }, + { 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL } }; @@ -1940,15 +2005,15 @@ public: { case 'N': if (BreakpointID::StringIsBreakpointName(option_value, error) && error.Success()) - m_name.SetValueFromCString(option_value); + m_name.SetValueFromString(option_value); break; case 'B': - if (m_breakpoint.SetValueFromCString(option_value).Fail()) + if (m_breakpoint.SetValueFromString(option_value).Fail()) error.SetErrorStringWithFormat ("unrecognized value \"%s\" for breakpoint", option_value); break; case 'D': - if (m_use_dummy.SetValueFromCString(option_value).Fail()) + if (m_use_dummy.SetValueFromString(option_value).Fail()) error.SetErrorStringWithFormat ("unrecognized value \"%s\" for use-dummy", option_value); break; @@ -2188,7 +2253,6 @@ public: } protected: -protected: virtual bool DoExecute (Args& command, CommandReturnObject &result) { |