From jingham at apple.com Mon Jun 14 13:09:01 2010 From: jingham at apple.com (Jim Ingham) Date: Mon, 14 Jun 2010 11:09:01 -0700 Subject: [Lldb-commits] [lldb] r105923 - /lldb/trunk/source/lldb.cpp In-Reply-To: <20100613193642.7A7E92A6C12C@llvm.org> References: <20100613193642.7A7E92A6C12C@llvm.org> Message-ID: I don't think we need to solve the problem of building for cross debugging right now, but as you make changes to get lldb building in Linux, it would be good to differentiate between ifdef's that are host related, and ones like those below that we're going to have to come back and fix to get Linux->MacOS X debugging working. gdb mixed these all up so that while you could do cross architecture debugging okay, it was harder to do cross OS debugging. It would be great to avoid that limitation in lldb. Maybe just put in a FIXME - cross-debugging everywhere, like here, where that is appropriate. Then when we get some time to come back and make this work, we won't have lost the information from your first pass... Jim On Jun 13, 2010, at 12:36 PM, Eli Friedman wrote: > Author: efriedma > Date: Sun Jun 13 14:36:42 2010 > New Revision: 105923 > > URL: http://llvm.org/viewvc/llvm-project?rev=105923&view=rev > Log: > Make include paths work on Linux. ifdef out stuff that isn't relevant to > Linux or doesn't compile on Linux. > > > Modified: > lldb/trunk/source/lldb.cpp > > Modified: lldb/trunk/source/lldb.cpp > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb.cpp?rev=105923&r1=105922&r2=105923&view=diff > ============================================================================== > --- lldb/trunk/source/lldb.cpp (original) > +++ lldb/trunk/source/lldb.cpp Sun Jun 13 14:36:42 2010 > @@ -9,23 +9,28 @@ > > #include "lldb/lldb-private.h" > #include "lldb/lldb-private-log.h" > +#include "lldb/Core/ArchSpec.h" > #include "lldb/Core/Log.h" > #include "lldb/Core/Timer.h" > #include "lldb/Host/Host.h" > -#include "ABIMacOSX_i386.h" > -#include "ABISysV_x86_64.h" > -#include "DisassemblerLLVM.h" > -#include "DynamicLoaderMacOSXDYLD.h" > -#include "ObjectContainerBSDArchive.h" > -#include "ObjectContainerUniversalMachO.h" > -#include "ObjectFileELF.h" > -#include "ObjectFileMachO.h" > -#include "ProcessMacOSX.h" > -#include "ProcessGDBRemote.h" > -#include "SymbolFileDWARF.h" > -#include "SymbolFileDWARFDebugMap.h" > -#include "SymbolFileSymtab.h" > -#include "SymbolVendorMacOSX.h" > +#include "lldb/Host/Mutex.h" > + > +#include "Plugins/Disassembler/llvm/DisassemblerLLVM.h" > +#include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" > +#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h" > +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" > +#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h" > +#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h" > +#include "Plugins/SymbolFile/Symtab/SymbolFileSymtab.h" > +#ifdef __APPLE__ > +#include "Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h" > +#include "Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h" > +#include "Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h" > +#include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" > +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" > +#include "Plugins/Process/MacOSX-User/source/ProcessMacOSX.h" > +#include "Plugins/Process/gdb-remote/ProcessGDBRemote.h" > +#endif > > using namespace lldb_private; > > @@ -47,20 +52,22 @@ > Log::Callbacks log_callbacks = { DisableLog, EnableLog, ListLogCategories }; > > Log::RegisterLogChannel ("lldb", log_callbacks); > + DisassemblerLLVM::Initialize(); > + ObjectContainerBSDArchive::Initialize(); > + ObjectFileELF::Initialize(); > + SymbolVendorMacOSX::Initialize(); > + SymbolFileDWARF::Initialize(); > + SymbolFileDWARFDebugMap::Initialize(); > + SymbolFileSymtab::Initialize(); > +#ifdef __APPLE__ > ABIMacOSX_i386::Initialize(); > ABISysV_x86_64::Initialize(); > - DisassemblerLLVM::Initialize(); > DynamicLoaderMacOSXDYLD::Initialize(); > ObjectContainerUniversalMachO::Initialize(); > - ObjectContainerBSDArchive::Initialize(); > - ObjectFileELF::Initialize(); > ObjectFileMachO::Initialize(); > ProcessGDBRemote::Initialize(); > ProcessMacOSX::Initialize(); > - SymbolFileDWARF::Initialize(); > - SymbolFileDWARFDebugMap::Initialize(); > - SymbolFileSymtab::Initialize(); > - SymbolVendorMacOSX::Initialize(); > +#endif > } > } > > @@ -75,17 +82,19 @@ > { > Timer scoped_timer (__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); > DisassemblerLLVM::Terminate(); > - DynamicLoaderMacOSXDYLD::Terminate(); > - ObjectContainerUniversalMachO::Terminate(); > ObjectContainerBSDArchive::Terminate(); > ObjectFileELF::Terminate(); > - ObjectFileMachO::Terminate(); > - ProcessGDBRemote::Terminate(); > - ProcessMacOSX::Terminate(); > + SymbolVendorMacOSX::Terminate(); > SymbolFileDWARF::Terminate(); > SymbolFileDWARFDebugMap::Terminate(); > SymbolFileSymtab::Terminate(); > - SymbolVendorMacOSX::Terminate(); > +#ifdef __APPLE__ > + DynamicLoaderMacOSXDYLD::Terminate(); > + ObjectContainerUniversalMachO::Terminate(); > + ObjectFileMachO::Terminate(); > + ProcessGDBRemote::Terminate(); > + ProcessMacOSX::Terminate(); > +#endif > } > > const char * > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From jingham at apple.com Tue Jun 15 13:47:14 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 15 Jun 2010 18:47:14 -0000 Subject: [Lldb-commits] [lldb] r106020 - in /lldb/trunk: include/lldb/ include/lldb/Core/ source/Commands/ source/Core/ tools/driver/ Message-ID: <20100615184714.A2D712A6C12E@llvm.org> Author: jingham Date: Tue Jun 15 13:47:14 2010 New Revision: 106020 URL: http://llvm.org/viewvc/llvm-project?rev=106020&view=rev Log: Change the Options parser over to use a mask rather than an ordinal for option sets. Fixed the Disassemble arguments so you can't specify start address or name in multiple ways. Fixed the command line input so you can specify the filename without "-f" even if you use other options. Modified: lldb/trunk/include/lldb/Core/Options.h lldb/trunk/include/lldb/lldb-defines.h lldb/trunk/include/lldb/lldb-types.h lldb/trunk/source/Commands/CommandObjectArgs.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp lldb/trunk/source/Commands/CommandObjectCall.cpp lldb/trunk/source/Commands/CommandObjectDisassemble.cpp lldb/trunk/source/Commands/CommandObjectDisassemble.h lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectFile.cpp lldb/trunk/source/Commands/CommandObjectImage.cpp lldb/trunk/source/Commands/CommandObjectLog.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectSourceFile.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Commands/CommandObjectVariable.cpp lldb/trunk/source/Core/Options.cpp lldb/trunk/tools/driver/Driver.cpp Modified: lldb/trunk/include/lldb/Core/Options.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Options.h?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Options.h (original) +++ lldb/trunk/include/lldb/Core/Options.h Tue Jun 15 13:47:14 2010 @@ -20,6 +20,7 @@ // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" #include "lldb/Core/Args.h" namespace lldb_private { @@ -134,8 +135,9 @@ struct option * GetLongOptions (); + // This gets passed the short option as an integer... void - OptionSeen (int option_idx); + OptionSeen (int short_option); bool VerifyOptions (CommandReturnObject &result); @@ -163,10 +165,10 @@ // this class. virtual const lldb::OptionDefinition* - GetDefinitions () = 0; + GetDefinitions () { return NULL; }; virtual void - ResetOptionValues () = 0; + ResetOptionValues (); //------------------------------------------------------------------ /// Set the value of an option. @@ -272,6 +274,7 @@ StringList &matches); protected: + // This is a set of options expressed as indexes into the options table for this Option. typedef std::set OptionSet; std::vector m_getopt_table; Modified: lldb/trunk/include/lldb/lldb-defines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-defines.h?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-defines.h (original) +++ lldb/trunk/include/lldb/lldb-defines.h Tue Jun 15 13:47:14 2010 @@ -70,7 +70,21 @@ #define LLDB_ARCH_DEFAULT_64BIT "systemArch64" #define LLDB_INVALID_CPUTYPE (0xFFFFFFFEu) - +//---------------------------------------------------------------------- +/// Option Set defintions +//---------------------------------------------------------------------- +// FIXME: I'm sure there's some #define magic that can create all 32 sets on the +// fly. That would have the added benefit of making this unreadable. +#define LLDB_MAX_NUM_OPTION_SETS 32 +#define LLDB_OPT_SET_ALL 0xFFFFFFFF +#define LLDB_OPT_SET_1 1 << 0 +#define LLDB_OPT_SET_2 1 << 1 +#define LLDB_OPT_SET_3 1 << 2 +#define LLDB_OPT_SET_4 1 << 3 +#define LLDB_OPT_SET_5 1 << 4 +#define LLDB_OPT_SET_6 1 << 5 +#define LLDB_OPT_SET_7 1 << 6 +#define LLDB_OPT_SET_8 1 << 7 #if defined(__cplusplus) Modified: lldb/trunk/include/lldb/lldb-types.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-types.h (original) +++ lldb/trunk/include/lldb/lldb-types.h Tue Jun 15 13:47:14 2010 @@ -131,7 +131,8 @@ typedef struct { - uint32_t usage_level; // Used to mark options that can be used together. + uint32_t usage_mask; // Used to mark options that can be used together. If 1 << n && usage_mask != 0 + // then this option belongs to option set n. bool required; // This option is required (in the current usage level) CONST_CHAR_PTR long_option; // Full name for this option. char short_option; // Single character for this option. Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Tue Jun 15 13:47:14 2010 @@ -273,7 +273,7 @@ lldb::OptionDefinition CommandObjectArgs::CommandOptions::g_option_table[] = { - { 0, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."}, + { LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."}, { 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Jun 15 13:47:14 2010 @@ -17,6 +17,7 @@ #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointIDList.h" #include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Core/Options.h" #include "lldb/Core/RegularExpression.h" #include "lldb/Core/StreamString.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -62,47 +63,32 @@ lldb::OptionDefinition CommandObjectBreakpointSet::CommandOptions::g_option_table[] = { - { 0, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", + { LLDB_OPT_SET_ALL, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "", + "Set the breakpoint only in this shared library (can use this option multiple times for multiple shlibs)."}, + + { LLDB_OPT_SET_ALL, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL, + "Ignore inlined subroutines when setting the breakppoint." }, + + { LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "Set the breakpoint by source location in this particular file."}, - { 0, true, "line", 'l', required_argument, NULL, 0, "", + { LLDB_OPT_SET_1, true, "line", 'l', required_argument, NULL, 0, "", "Set the breakpoint by source location at this particular line."}, - { 0, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "", - "Set the breakpoint only in this shared library (can use this option multiple times for multiple shlibs)."}, - // Comment out this option for the moment, as we don't actually use it, but will in the future. // This way users won't see it, but the infrastructure is left in place. // { 0, false, "column", 'c', required_argument, NULL, "", // "Set the breakpoint by source location at this particular column."}, - { 0, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL, - "Ignore inlined subroutines when setting the breakppoint." }, - - { 1, true, "address", 'a', required_argument, NULL, 0, "
", + { LLDB_OPT_SET_2, true, "address", 'a', required_argument, NULL, 0, "
", "Set the breakpoint by address, at the specified address."}, - { 1, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL, - "Ignore inlined subroutines when setting the breakppoint." }, - - { 2, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "", + { LLDB_OPT_SET_3, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "", "Set the breakpoint by function name." }, - { 2, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "", - "Set the breakpoint only in this shared library (can use this option multiple times for multiple shlibs)."}, - - { 2, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL, - "Ignore inlined subroutines when setting the breakpoint." }, - - { 3, true, "func_regex", 'r', required_argument, NULL, 0, "", + { LLDB_OPT_SET_4, true, "func_regex", 'r', required_argument, NULL, 0, "", "Set the breakpoint by function name, evaluating a regular-expression to find the function name(s)." }, - { 3, false, "shlib", 's', required_argument, NULL, CommandCompletions::eModuleCompletion, "", - "Set the breakpoint only in this shared library (can use this option multiple times for multiple shlibs)."}, - - { 3, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL, - "Ignore inlined subroutines when setting the breakpoint." }, - { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -505,25 +491,19 @@ lldb::OptionDefinition CommandObjectBreakpointList::CommandOptions::g_option_table[] = { - { 0, false, "brief", 'b', no_argument, NULL, 0, NULL, + { LLDB_OPT_SET_ALL, false, "internal", 'i', no_argument, NULL, 0, NULL, + "Show debugger internal breakpoints" }, + + { LLDB_OPT_SET_1, false, "brief", 'b', no_argument, NULL, 0, NULL, "Give a brief description of the breakpoint (no location info)."}, // FIXME: We need to add an "internal" command, and then add this sort of thing to it. // But I need to see it for now, and don't want to wait. - { 0, false, "internal", 'i', no_argument, NULL, 0, NULL, - "Show debugger internal breakpoints" }, - - { 1, false, "full", 'f', no_argument, NULL, 0, NULL, + { LLDB_OPT_SET_2, false, "full", 'f', no_argument, NULL, 0, NULL, "Give a full description of the breakpoint and its locations."}, - // DITTO FIXME - { 1, false, "internal", 'i', no_argument, NULL, 0, NULL, - "Show debugger internal breakpoints" }, - { 2, false, "verbose", 'v', no_argument, NULL, 0, NULL, + { LLDB_OPT_SET_3, false, "verbose", 'v', no_argument, NULL, 0, NULL, "Explain everything we know about the breakpoint (for debugging debugger bugs)." }, - // DITTO FIXME - { 2, false, "internal", 'i', no_argument, NULL, 0, NULL, - "Show debugger internal breakpoints" }, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Tue Jun 15 13:47:14 2010 @@ -44,13 +44,13 @@ lldb::OptionDefinition CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] = { - { 0, true, "script", 's', no_argument, NULL, 0, NULL, + { LLDB_OPT_SET_1, true, "script", 's', no_argument, NULL, 0, NULL, "Write the breakpoint command script in the default scripting language."}, - { 1, true, "python", 'p', no_argument, NULL, 0, NULL, + { LLDB_OPT_SET_2, true, "python", 'p', no_argument, NULL, 0, NULL, "Write the breakpoint command script in the Python scripting language."}, - { 2, true, "commands", 'c', no_argument, NULL, 0, NULL, + { LLDB_OPT_SET_3, true, "commands", 'c', no_argument, NULL, 0, NULL, "Write the breakpoint command script using the command line commands."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } Modified: lldb/trunk/source/Commands/CommandObjectCall.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCall.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCall.cpp Tue Jun 15 13:47:14 2010 @@ -297,11 +297,11 @@ lldb::OptionDefinition CommandObjectCall::CommandOptions::g_option_table[] = { -{ 0, true, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."}, -{ 0, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."}, -{ 0, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."}, -{ 0, false, "noexecute", 'n', no_argument, NULL, 0, "no execute", "Only JIT and copy the wrapper & arguments, but don't execute."}, -{ 0, false, "useabi", 'a', no_argument, NULL, 0, NULL, "Use the ABI instead of the JIT to marshall arguments."}, +{ LLDB_OPT_SET_1, true, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."}, +{ LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."}, +{ LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."}, +{ LLDB_OPT_SET_1, false, "noexecute", 'n', no_argument, NULL, 0, "no execute", "Only JIT and copy the wrapper & arguments, but don't execute."}, +{ LLDB_OPT_SET_1, false, "useabi", 'a', no_argument, NULL, 0, NULL, "Use the ABI instead of the JIT to marshall arguments."}, { 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Tue Jun 15 13:47:14 2010 @@ -34,7 +34,8 @@ CommandObjectDisassemble::CommandOptions::CommandOptions () : Options(), m_func_name(), - m_load_addr() + m_start_addr(), + m_end_addr () { ResetOptionValues(); } @@ -64,13 +65,21 @@ show_bytes = true; break; - case 'a': - m_load_addr = Args::StringToUInt64(optarg, LLDB_INVALID_ADDRESS, 0); - if (m_load_addr == LLDB_INVALID_ADDRESS) - m_load_addr = Args::StringToUInt64(optarg, LLDB_INVALID_ADDRESS, 16); + case 's': + m_start_addr = Args::StringToUInt64(optarg, LLDB_INVALID_ADDRESS, 0); + if (m_start_addr == LLDB_INVALID_ADDRESS) + m_start_addr = Args::StringToUInt64(optarg, LLDB_INVALID_ADDRESS, 16); - if (m_load_addr == LLDB_INVALID_ADDRESS) - error.SetErrorStringWithFormat ("Invalid address string '%s'.\n", optarg); + if (m_start_addr == LLDB_INVALID_ADDRESS) + error.SetErrorStringWithFormat ("Invalid start address string '%s'.\n", optarg); + break; + case 'e': + m_end_addr = Args::StringToUInt64(optarg, LLDB_INVALID_ADDRESS, 0); + if (m_end_addr == LLDB_INVALID_ADDRESS) + m_end_addr = Args::StringToUInt64(optarg, LLDB_INVALID_ADDRESS, 16); + + if (m_end_addr == LLDB_INVALID_ADDRESS) + error.SetErrorStringWithFormat ("Invalid end address string '%s'.\n", optarg); break; case 'n': @@ -97,7 +106,8 @@ show_bytes = false; num_lines_context = 0; m_func_name.clear(); - m_load_addr = LLDB_INVALID_ADDRESS; + m_start_addr = LLDB_INVALID_ADDRESS; + m_end_addr = LLDB_INVALID_ADDRESS; } const lldb::OptionDefinition* @@ -109,22 +119,17 @@ lldb::OptionDefinition CommandObjectDisassemble::CommandOptions::g_option_table[] = { -{ 0, false, "bytes", 'b', no_argument, NULL, 0, NULL, "Show opcode bytes when disassembling."}, -{ 0, false, "context", 'c', required_argument, NULL, 0, "", "Number of context lines of source to show."}, -{ 0, false, "mixed", 'm', no_argument, NULL, 0, NULL, "Enable mixed source and assembly display."}, -{ 0, false, "raw", 'r', no_argument, NULL, 0, NULL, "Print raw disassembly with no symbol information."}, - -{ 1, false, "address", 'a', required_argument, NULL, 0, "
", "Address to start disassembling."}, -{ 1, false, "bytes", 'b', no_argument, NULL, 0, NULL, "Show opcode bytes when disassembling."}, -{ 1, false, "context", 'c', required_argument, NULL, 0, "", "Number of context lines of source to show."}, -{ 1, false, "mixed", 'm', no_argument, NULL, 0, NULL, "Enable mixed source and assembly display."}, -{ 1, false, "raw", 'r', no_argument, NULL, 0, NULL, "Print raw disassembly with no symbol information."}, - -{ 2, false, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "", "Disassemble entire contents of the given function name."}, -{ 2, false, "bytes", 'b', no_argument, NULL, 0, NULL, "Show opcode bytes when disassembling."}, -{ 2, false, "context", 'c', required_argument, NULL, 0, "", "Number of context lines of source to show."}, -{ 2, false, "mixed", 'm', no_argument, NULL, 0, NULL, "Enable mixed source and assembly display."}, -{ 2, false, "raw", 'r', no_argument, NULL, 0, NULL, "Print raw disassembly with no symbol information."}, +{ LLDB_OPT_SET_ALL, false, "bytes", 'b', no_argument, NULL, 0, NULL, "Show opcode bytes when disassembling."}, +{ LLDB_OPT_SET_ALL, false, "context", 'c', required_argument, NULL, 0, "", "Number of context lines of source to show."}, +{ LLDB_OPT_SET_ALL, false, "mixed", 'm', no_argument, NULL, 0, NULL, "Enable mixed source and assembly display."}, +{ LLDB_OPT_SET_ALL, false, "raw", 'r', no_argument, NULL, 0, NULL, "Print raw disassembly with no symbol information."}, + +{ LLDB_OPT_SET_1, true, "start-address", 's', required_argument, NULL, 0, "", "Address to start disassembling."}, +{ LLDB_OPT_SET_1, false, "end-address", 'e', required_argument, NULL, 0, "", "Address to start disassembling."}, + +{ LLDB_OPT_SET_2, true, "name", 'n', required_argument, NULL, CommandCompletions::eSymbolCompletion, "", "Disassemble entire contents of the given function name."}, + +{ LLDB_OPT_SET_3, false, "current-frame", 'f', no_argument, NULL, 0, "", "Disassemble entire contents of the current frame's function."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -138,7 +143,7 @@ CommandObjectDisassemble::CommandObjectDisassemble () : CommandObject ("disassemble", "Disassemble bytes in the current function or anywhere in the inferior program.", - "disassemble [[ []] | ] []") + "disassemble []") { } @@ -317,15 +322,35 @@ lldb::addr_t end_addr = LLDB_INVALID_ADDRESS; ConstString name; const size_t argc = command.GetArgumentCount(); - if (argc == 0 && m_options.m_load_addr != LLDB_INVALID_ADDRESS) + if (argc != 0) { - addr = m_options.m_load_addr; - end_addr = addr + DEFAULT_DISASM_BYTE_SIZE; - } else if (argc == 0 && !m_options.m_func_name.empty()) + result.AppendErrorWithFormat ("\"disassemble\" doesn't take any arguments.\n"); + result.SetStatus (eReturnStatusFailed); + return false; + } + + if (m_options.m_start_addr != LLDB_INVALID_ADDRESS) + { + addr = m_options.m_start_addr; + if (m_options.m_end_addr != LLDB_INVALID_ADDRESS) + { + end_addr = m_options.m_end_addr; + if (end_addr < addr) + { + result.AppendErrorWithFormat ("End address before start address.\n"); + result.SetStatus (eReturnStatusFailed); + return false; + } + } + else + end_addr = addr + DEFAULT_DISASM_BYTE_SIZE; + } + else if (!m_options.m_func_name.empty()) { ConstString tmpname(m_options.m_func_name.c_str()); name = tmpname; - } else if (argc == 0) + } + else { ExecutionContext exe_ctx(context->GetExecutionContext()); if (exe_ctx.frame) @@ -361,38 +386,6 @@ return false; } } - else if (argc == 1) - { - const char *arg = command.GetArgumentAtIndex(0); - addr = Args::StringToAddress (arg); - if (addr == LLDB_INVALID_ADDRESS) - { - // Lookup function or symbol name? - ConstString tmpname(arg); - name = tmpname; - } - else - { - end_addr = addr + DEFAULT_DISASM_BYTE_SIZE; - } - } - else if (argc >= 1 && argc <= 2) - { - addr = Args::StringToAddress (command.GetArgumentAtIndex(0)); - if (addr == LLDB_INVALID_ADDRESS) - { - result.AppendErrorWithFormat ("Unable to parse address '%s'.\n", command.GetArgumentAtIndex(0)); - result.SetStatus (eReturnStatusFailed); - return false; - } - end_addr = Args::StringToAddress (command.GetArgumentAtIndex(1), addr); - if (end_addr == LLDB_INVALID_ADDRESS) - { - result.AppendErrorWithFormat ("Unable to parse address '%s'.\n", command.GetArgumentAtIndex(1)); - result.SetStatus (eReturnStatusFailed); - return false; - } - } if (!name.IsEmpty()) { @@ -413,19 +406,10 @@ return false; } } - - if (addr < end_addr) + else { Disassemble (context, interpreter, result, disassembler, addr, end_addr); } - if (addr == LLDB_INVALID_ADDRESS && name.IsEmpty()) - { - result.AppendError ("No recognizable address of function name provided"); - result.SetStatus (eReturnStatusFailed); - return false; - } - { - return result.Succeeded(); - } + return result.Succeeded(); } Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Tue Jun 15 13:47:14 2010 @@ -49,7 +49,8 @@ uint32_t num_lines_context; bool raw; std::string m_func_name; - lldb::addr_t m_load_addr; + lldb::addr_t m_start_addr; + lldb::addr_t m_end_addr; static lldb::OptionDefinition g_option_table[]; }; Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Jun 15 13:47:14 2010 @@ -546,9 +546,9 @@ lldb::OptionDefinition CommandObjectExpression::CommandOptions::g_option_table[] = { -{ 0, true, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."}, -{ 0, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."}, -{ 0, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."}, +{ LLDB_OPT_SET_1, true, "language", 'l', required_argument, NULL, 0, "[c|c++|objc|objc++]", "Sets the language to use when parsing the expression."}, +{ LLDB_OPT_SET_2, false, "format", 'f', required_argument, NULL, 0, "[ [bool|b] | [bin] | [char|c] | [oct|o] | [dec|i|d|u] | [hex|x] | [float|f] | [cstr|s] ]", "Specify the format that the expression output should use."}, +{ LLDB_OPT_SET_3, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable verbose debug logging of the expression parsing and evaluation."}, { 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFile.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFile.cpp Tue Jun 15 13:47:14 2010 @@ -38,7 +38,7 @@ lldb::OptionDefinition CommandObjectFile::CommandOptions::g_option_table[] = { - { 0, false, "arch", 'a', required_argument, NULL, 0, "", "Specify the architecture to launch."}, + { LLDB_OPT_SET_1, false, "arch", 'a', required_argument, NULL, 0, "", "Specify the architecture to launch."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectImage.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectImage.cpp Tue Jun 15 13:47:14 2010 @@ -1066,13 +1066,13 @@ lldb::OptionDefinition CommandObjectImageList::CommandOptions::g_option_table[] = { -{ 0, false, "arch", 'a', optional_argument, NULL, 0, "", "Display the architecture when listing images."}, -{ 0, false, "uuid", 'u', no_argument, NULL, 0, NULL, "Display the UUID when listing images."}, -{ 0, false, "fullpath", 'f', optional_argument, NULL, 0, "", "Display the fullpath to the image object file."}, -{ 0, false, "directory", 'd', optional_argument, NULL, 0, "", "Display the directory with optional width for the image object file."}, -{ 0, false, "basename", 'b', optional_argument, NULL, 0, "", "Display the basename with optional width for the image object file."}, -{ 0, false, "symfile", 's', optional_argument, NULL, 0, "", "Display the fullpath to the image symbol file with optional width."}, -{ 0, false, "symfile-basename", 'S', optional_argument, NULL, 0, "", "Display the basename to the image symbol file with optional width."}, +{ LLDB_OPT_SET_1, false, "arch", 'a', optional_argument, NULL, 0, "", "Display the architecture when listing images."}, +{ LLDB_OPT_SET_1, false, "uuid", 'u', no_argument, NULL, 0, NULL, "Display the UUID when listing images."}, +{ LLDB_OPT_SET_1, false, "fullpath", 'f', optional_argument, NULL, 0, "", "Display the fullpath to the image object file."}, +{ LLDB_OPT_SET_1, false, "directory", 'd', optional_argument, NULL, 0, "", "Display the directory with optional width for the image object file."}, +{ LLDB_OPT_SET_1, false, "basename", 'b', optional_argument, NULL, 0, "", "Display the basename with optional width for the image object file."}, +{ LLDB_OPT_SET_1, false, "symfile", 's', optional_argument, NULL, 0, "", "Display the fullpath to the image symbol file with optional width."}, +{ LLDB_OPT_SET_1, false, "symfile-basename", 'S', optional_argument, NULL, 0, "", "Display the basename to the image symbol file with optional width."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -1381,15 +1381,14 @@ lldb::OptionDefinition CommandObjectImageLookup::CommandOptions::g_option_table[] = { -{ 1, true, "address", 'a', required_argument, NULL, 0, "", "Lookup an address in one or more executable images."}, -{ 1, false, "offset", 'o', required_argument, NULL, 0, "", "When looking up an address subtract from any addresses before doing the lookup."}, -{ 2, true, "symbol", 's', required_argument, NULL, 0, "", "Lookup a symbol by name in the symbol tables in one or more executable images."}, -{ 2, false, "regex", 'r', no_argument, NULL, 0, NULL, "The argument for name lookups are regular expressions."}, -{ 3, true, "file", 'f', required_argument, NULL, 0, "", "Lookup a file by fullpath or basename in one or more executable images."}, -{ 3, false, "line", 'l', required_argument, NULL, 0, "", "Lookup a line number in a file (must be used in conjunction with --file)."}, -{ 3, false, "no-inlines", 'i', no_argument, NULL, 0, NULL, "Check inline line entries (must be used in conjunction with --file)."}, -{ 4, true, "function", 'n', required_argument, NULL, 0, "", "Lookup a function by name in the debug symbols in one or more executable images."}, -{ 5, false, "regex", 'r', no_argument, NULL, 0, NULL, "The argument for name lookups are regular expressions."}, +{ LLDB_OPT_SET_1, true, "address", 'a', required_argument, NULL, 0, "", "Lookup an address in one or more executable images."}, +{ LLDB_OPT_SET_1, false, "offset", 'o', required_argument, NULL, 0, "", "When looking up an address subtract from any addresses before doing the lookup."}, +{ LLDB_OPT_SET_2, true, "symbol", 's', required_argument, NULL, 0, "", "Lookup a symbol by name in the symbol tables in one or more executable images."}, +{ LLDB_OPT_SET_2, false, "regex", 'r', no_argument, NULL, 0, NULL, "The argument for name lookups are regular expressions."}, +{ LLDB_OPT_SET_3, true, "file", 'f', required_argument, NULL, 0, "", "Lookup a file by fullpath or basename in one or more executable images."}, +{ LLDB_OPT_SET_3, false, "line", 'l', required_argument, NULL, 0, "", "Lookup a line number in a file (must be used in conjunction with --file)."}, +{ LLDB_OPT_SET_3, false, "no-inlines", 'i', no_argument, NULL, 0, NULL, "Check inline line entries (must be used in conjunction with --file)."}, +{ LLDB_OPT_SET_4, true, "function", 'n', required_argument, NULL, 0, "", "Lookup a function by name in the debug symbols in one or more executable images."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Tue Jun 15 13:47:14 2010 @@ -226,14 +226,14 @@ lldb::OptionDefinition CommandObjectLogEnable::CommandOptions::g_option_table[] = { -{ 0, false, "file", 'f', required_argument, NULL, 0, "", "Set the destination file to log to."}, -{ 0, false, "threadsafe", 't', no_argument, NULL, 0, NULL, "Enable thread safe logging to avoid interweaved log lines." }, -{ 0, false, "verbose", 'v', no_argument, NULL, 0, NULL, "Enable verbose logging." }, -{ 0, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable debug logging." }, -{ 0, false, "sequence", 's', no_argument, NULL, 0, NULL, "Prepend all log lines with an increasing integer sequence id." }, -{ 0, false, "timestamp", 'T', no_argument, NULL, 0, NULL, "Prepend all log lines with a timestamp." }, -{ 0, false, "pid-tid", 'p', no_argument, NULL, 0, NULL, "Prepend all log lines with the process and thread ID that generates the log line." }, -{ 0, false, "thread-name",'n', no_argument, NULL, 0, NULL, "Prepend all log lines with the thread name for the thread that generates the log line." }, +{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, 0, "", "Set the destination file to log to."}, +{ LLDB_OPT_SET_1, false, "threadsafe", 't', no_argument, NULL, 0, NULL, "Enable thread safe logging to avoid interweaved log lines." }, +{ LLDB_OPT_SET_1, false, "verbose", 'v', no_argument, NULL, 0, NULL, "Enable verbose logging." }, +{ LLDB_OPT_SET_1, false, "debug", 'g', no_argument, NULL, 0, NULL, "Enable debug logging." }, +{ LLDB_OPT_SET_1, false, "sequence", 's', no_argument, NULL, 0, NULL, "Prepend all log lines with an increasing integer sequence id." }, +{ LLDB_OPT_SET_1, false, "timestamp", 'T', no_argument, NULL, 0, NULL, "Prepend all log lines with a timestamp." }, +{ LLDB_OPT_SET_1, false, "pid-tid", 'p', no_argument, NULL, 0, NULL, "Prepend all log lines with the process and thread ID that generates the log line." }, +{ LLDB_OPT_SET_1, false, "thread-name",'n', no_argument, NULL, 0, NULL, "Prepend all log lines with the thread name for the thread that generates the log line." }, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Jun 15 13:47:14 2010 @@ -317,10 +317,10 @@ lldb::OptionDefinition CommandObjectMemoryRead::CommandOptions::g_option_table[] = { - { 0, false, "format", 'f', required_argument, NULL, 0, "", "The format that will be used to display the memory. Defaults to bytes with ASCII (--format=Y)."}, - { 0, false, "size", 's', required_argument, NULL, 0, "","The size in bytes to use when displaying with the selected format."}, - { 0, false, "num-per-line", 'l', required_argument, NULL, 0, "", "The number of items per line to display."}, - { 0, false, "count", 'c', required_argument, NULL, 0, "", "The number of total items to display."}, + { LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "", "The format that will be used to display the memory. Defaults to bytes with ASCII (--format=Y)."}, + { LLDB_OPT_SET_1, false, "size", 's', required_argument, NULL, 0, "","The size in bytes to use when displaying with the selected format."}, + { LLDB_OPT_SET_1, false, "num-per-line", 'l', required_argument, NULL, 0, "", "The number of items per line to display."}, + { LLDB_OPT_SET_1, false, "count", 'c', required_argument, NULL, 0, "", "The number of total items to display."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -656,8 +656,8 @@ lldb::OptionDefinition CommandObjectMemoryWrite::CommandOptions::g_option_table[] = { - { 0, false, "format", 'f', required_argument, NULL, 0, "", "The format value types that will be decoded and written to memory."}, - { 0, false, "size", 's', required_argument, NULL, 0, "","The size in bytes of the values to write to memory."}, + { LLDB_OPT_SET_1, false, "format", 'f', required_argument, NULL, 0, "", "The format value types that will be decoded and written to memory."}, + { LLDB_OPT_SET_1, false, "size", 's', required_argument, NULL, 0, "","The size in bytes of the values to write to memory."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Jun 15 13:47:14 2010 @@ -264,11 +264,11 @@ lldb::OptionDefinition CommandObjectProcessLaunch::CommandOptions::g_option_table[] = { -{ 0, false, "stop-at-entry", 's', no_argument, NULL, 0, NULL, "Stop at the entry point of the program when launching a process."}, -{ 0, false, "stdin", 'i', required_argument, NULL, 0, "", "Redirect stdin for the process to ."}, -{ 0, false, "stdout", 'o', required_argument, NULL, 0, "", "Redirect stdout for the process to ."}, -{ 0, false, "stderr", 'e', required_argument, NULL, 0, "", "Redirect stderr for the process to ."}, -{ 0, false, "plugin", 'p', required_argument, NULL, 0, "", "Name of the process plugin you want to use."}, +{ LLDB_OPT_SET_1, false, "stop-at-entry", 's', no_argument, NULL, 0, NULL, "Stop at the entry point of the program when launching a process."}, +{ LLDB_OPT_SET_1, false, "stdin", 'i', required_argument, NULL, 0, "", "Redirect stdin for the process to ."}, +{ LLDB_OPT_SET_1, false, "stdout", 'o', required_argument, NULL, 0, "", "Redirect stdout for the process to ."}, +{ LLDB_OPT_SET_1, false, "stderr", 'e', required_argument, NULL, 0, "", "Redirect stderr for the process to ."}, +{ LLDB_OPT_SET_1, false, "plugin", 'p', required_argument, NULL, 0, "", "Name of the process plugin you want to use."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -478,10 +478,10 @@ lldb::OptionDefinition CommandObjectProcessAttach::CommandOptions::g_option_table[] = { -{ 0, false, "pid", 'p', required_argument, NULL, 0, "", "The process ID of an existing process to attach to."}, -{ 0, false, "plugin", 'P', required_argument, NULL, 0, "", "Name of the process plugin you want to use."}, -{ 1, true, "name", 'n', required_argument, NULL, 0, "", "The name of the process to attach to."}, -{ 1, false, "waitfor", 'w', no_argument, NULL, 0, NULL, "Wait for the the process with to launch."}, +{ LLDB_OPT_SET_ALL, false, "plugin", 'P', required_argument, NULL, 0, "", "Name of the process plugin you want to use."}, +{ LLDB_OPT_SET_1, false, "pid", 'p', required_argument, NULL, 0, "", "The process ID of an existing process to attach to."}, +{ LLDB_OPT_SET_2, true, "name", 'n', required_argument, NULL, 0, "", "The name of the process to attach to."}, +{ LLDB_OPT_SET_2, false, "waitfor", 'w', no_argument, NULL, 0, NULL, "Wait for the the process with to launch."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectSourceFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSourceFile.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSourceFile.cpp Tue Jun 15 13:47:14 2010 @@ -85,9 +85,9 @@ lldb::OptionDefinition CommandObjectSourceFile::CommandOptions::g_option_table[] = { -{ 0, false, "line", 'l', required_argument, NULL, 0, "", "The line number at which to start the display source."}, -{ 0, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "The file from which to display source."}, -{ 0, false, "count", 'n', required_argument, NULL, 0, "", "The number of source lines to display."}, +{ LLDB_OPT_SET_1, false, "line", 'l', required_argument, NULL, 0, "", "The line number at which to start the display source."}, +{ LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "The file from which to display source."}, +{ LLDB_OPT_SET_1, false, "count", 'n', required_argument, NULL, 0, "", "The number of source lines to display."}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Tue Jun 15 13:47:14 2010 @@ -619,8 +619,8 @@ lldb::OptionDefinition CommandObjectThreadStepWithTypeAndScope::CommandOptions::g_option_table[] = { -{ 0, true, "avoid_no_debug", 'a', required_argument, NULL, 0, "", "Should step-in step over functions with no debug information"}, -{ 0, true, "run_mode", 'm', required_argument, g_tri_running_mode, 0, "", "Determine how to run other threads while stepping this one"}, +{ LLDB_OPT_SET_1, true, "avoid_no_debug", 'a', required_argument, NULL, 0, "", "Should step-in step over functions with no debug information"}, +{ LLDB_OPT_SET_1, true, "run_mode", 'm', required_argument, g_tri_running_mode, 0, "", "Determine how to run other threads while stepping this one"}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; @@ -1056,9 +1056,9 @@ lldb::OptionDefinition CommandObjectThreadUntil::CommandOptions::g_option_table[] = { -{ 0, true, "frame", 'f', required_argument, NULL, 0, "", "Frame index for until operation - defaults to 0"}, -{ 0, true, "thread", 't', required_argument, NULL, 0, "", "Thread index for the thread for until operation"}, -{ 0, true, "run_mode", 'm', required_argument, g_duo_running_mode, 0, "", "Determine how to run other threads while stepping this one"}, +{ LLDB_OPT_SET_1, true, "frame", 'f', required_argument, NULL, 0, "", "Frame index for until operation - defaults to 0"}, +{ LLDB_OPT_SET_1, true, "thread", 't', required_argument, NULL, 0, "", "Thread index for the thread for until operation"}, +{ LLDB_OPT_SET_1, true, "run_mode", 'm', required_argument, g_duo_running_mode, 0, "", "Determine how to run other threads while stepping this one"}, { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; Modified: lldb/trunk/source/Commands/CommandObjectVariable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectVariable.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectVariable.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectVariable.cpp Tue Jun 15 13:47:14 2010 @@ -761,20 +761,20 @@ lldb::OptionDefinition CommandObjectVariableList::CommandOptions::g_option_table[] = { -{ 0, false, "debug", 'D', no_argument, NULL, 0, NULL, "Show verbose debug information."}, -{ 0, false, "depth", 'd', required_argument, NULL, 0, "", "Set the max recurse depth when dumping aggregate types (default is infinity)."}, -{ 0, false, "globals", 'g', no_argument, NULL, 0, NULL, "List global and static variables for the current stack frame source file."}, -{ 0, false, "global", 'G', required_argument, NULL, 0, NULL, "Find a global variable by name (which might not be in the current stack frame source file)."}, -{ 0, false, "location", 'L', no_argument, NULL, 0, NULL, "Show variable location information."}, -{ 0, false, "name", 'n', required_argument, NULL, 0, "", "Lookup a variable by name or regex (--regex) for the current execution context."}, -{ 0, false, "no-args", 'a', no_argument, NULL, 0, NULL, "Omit function arguments."}, -{ 0, false, "no-locals", 'l', no_argument, NULL, 0, NULL, "Omit local variables."}, -{ 0, false, "no-types", 't', no_argument, NULL, 0, NULL, "Omit variable type names."}, -{ 0, false, "no-summary", 'y', no_argument, NULL, 0, NULL, "Omit summary information."}, -{ 0, false, "scope", 's', no_argument, NULL, 0, NULL, "Show variable scope (argument, local, global, static)."}, -{ 0, false, "objc", 'o', no_argument, NULL, 0, NULL, "When looking up a variable by name (--name), print as an Objective-C object."}, -{ 0, false, "ptr-depth", 'p', required_argument, NULL, 0, "", "The number of pointers to be traversed when dumping values (default is zero)."}, -{ 0, false, "regex", 'r', no_argument, NULL, 0, NULL, "The argument for name lookups are regular expressions."}, +{ LLDB_OPT_SET_1, false, "debug", 'D', no_argument, NULL, 0, NULL, "Show verbose debug information."}, +{ LLDB_OPT_SET_1, false, "depth", 'd', required_argument, NULL, 0, "", "Set the max recurse depth when dumping aggregate types (default is infinity)."}, +{ LLDB_OPT_SET_1, false, "globals", 'g', no_argument, NULL, 0, NULL, "List global and static variables for the current stack frame source file."}, +{ LLDB_OPT_SET_1, false, "global", 'G', required_argument, NULL, 0, NULL, "Find a global variable by name (which might not be in the current stack frame source file)."}, +{ LLDB_OPT_SET_1, false, "location", 'L', no_argument, NULL, 0, NULL, "Show variable location information."}, +{ LLDB_OPT_SET_1, false, "name", 'n', required_argument, NULL, 0, "", "Lookup a variable by name or regex (--regex) for the current execution context."}, +{ LLDB_OPT_SET_1, false, "no-args", 'a', no_argument, NULL, 0, NULL, "Omit function arguments."}, +{ LLDB_OPT_SET_1, false, "no-locals", 'l', no_argument, NULL, 0, NULL, "Omit local variables."}, +{ LLDB_OPT_SET_1, false, "no-types", 't', no_argument, NULL, 0, NULL, "Omit variable type names."}, +{ LLDB_OPT_SET_1, false, "no-summary", 'y', no_argument, NULL, 0, NULL, "Omit summary information."}, +{ LLDB_OPT_SET_1, false, "scope", 's', no_argument, NULL, 0, NULL, "Show variable scope (argument, local, global, static)."}, +{ LLDB_OPT_SET_1, false, "objc", 'o', no_argument, NULL, 0, NULL, "When looking up a variable by name (--name), print as an Objective-C object."}, +{ LLDB_OPT_SET_1, false, "ptr-depth", 'p', required_argument, NULL, 0, "", "The number of pointers to be traversed when dumping values (default is zero)."}, +{ LLDB_OPT_SET_1, false, "regex", 'r', no_argument, NULL, 0, NULL, "The argument for name lookups are regular expressions."}, { 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL } }; Modified: lldb/trunk/source/Core/Options.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Options.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/source/Core/Options.cpp (original) +++ lldb/trunk/source/Core/Options.cpp Tue Jun 15 13:47:14 2010 @@ -31,6 +31,7 @@ Options::Options () : m_getopt_table () { + BuildValidOptionSets(); } Options::~Options () @@ -160,6 +161,9 @@ return options_are_valid; } +// This is called in the Options constructor, though we could call it lazily if that ends up being +// a performance problem. + void Options::BuildValidOptionSets () { @@ -173,32 +177,52 @@ return; const lldb::OptionDefinition *full_options_table = GetDefinitions(); - uint32_t usage_level = 0; m_required_options.resize(1); m_optional_options.resize(1); - - for (int i = 0; i < num_options; ++i) + + // First count the number of option sets we've got. Ignore LLDB_ALL_OPTION_SETS... + + uint32_t num_option_sets = 0; + + for (int i = 0; i < num_options; i++) { - // NOTE: Assumption: The full options table is ordered with usage level growing monotonically. - assert (full_options_table[i].usage_level >= usage_level); - - if (full_options_table[i].usage_level > usage_level) + uint32_t this_usage_mask = full_options_table[i].usage_mask; + if (this_usage_mask == LLDB_OPT_SET_ALL) { - // start a new level - usage_level = full_options_table[i].usage_level; - m_required_options.resize(m_required_options.size()+1); - m_optional_options.resize(m_optional_options.size()+1); + if (num_option_sets == 0) + num_option_sets = 1; } else { - assert (m_required_options.empty() == false); - assert (m_optional_options.empty() == false); + for (int j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++) + { + if (this_usage_mask & 1 << j) + { + if (num_option_sets <= j) + num_option_sets = j + 1; + } + } } + } - if (full_options_table[i].required) - m_required_options.back().insert(full_options_table[i].short_option); - else - m_optional_options.back().insert(full_options_table[i].short_option); + if (num_option_sets > 0) + { + m_required_options.resize(num_option_sets); + m_optional_options.resize(num_option_sets); + + for (int i = 0; i < num_options; ++i) + { + for (int j = 0; j < num_option_sets; j++) + { + if (full_options_table[i].usage_mask & 1 << j) + { + if (full_options_table[i].required) + m_required_options[j].insert(full_options_table[i].short_option); + else + m_optional_options[j].insert(full_options_table[i].short_option); + } + } + } } } @@ -206,6 +230,9 @@ Options::NumCommandOptions () { const lldb::OptionDefinition *full_options_table = GetDefinitions (); + if (full_options_table == NULL) + return 0; + int i = 0; if (full_options_table != NULL) @@ -352,54 +379,61 @@ // [options-for-level-1] // etc. - uint32_t usage_level = 0; const uint32_t num_options = NumCommandOptions(); + if (num_options == 0) + return; + + BuildValidOptionSets (); + int num_option_sets = m_required_options.size(); + uint32_t i; - for (i = 0; i < num_options; ++i) + + for (uint32_t opt_set = 0; opt_set < num_option_sets; ++opt_set) { - if (i==0 || full_options_table[i].usage_level > usage_level) + uint32_t opt_set_mask; + + opt_set_mask = 1 << opt_set; + if (opt_set > 0) + strm.Printf ("\n"); + strm.Indent (name); + + for (i = 0; i < num_options; ++i) { - // start a new level - usage_level = full_options_table[i].usage_level; - if (usage_level > 0) + if (full_options_table[i].usage_mask & opt_set_mask) { - strm.Printf ("\n"); - } - strm.Indent (name); - } - - // Add current option to the end of out_stream. + // Add current option to the end of out_stream. - if (full_options_table[i].required) - { - if (full_options_table[i].option_has_arg == required_argument) - { - strm.Printf (" -%c %s", - full_options_table[i].short_option, - full_options_table[i].argument_name); - } - else if (full_options_table[i].option_has_arg == optional_argument) - { - strm.Printf (" -%c [%s]", - full_options_table[i].short_option, - full_options_table[i].argument_name); + if (full_options_table[i].required) + { + if (full_options_table[i].option_has_arg == required_argument) + { + strm.Printf (" -%c %s", + full_options_table[i].short_option, + full_options_table[i].argument_name); + } + else if (full_options_table[i].option_has_arg == optional_argument) + { + strm.Printf (" -%c [%s]", + full_options_table[i].short_option, + full_options_table[i].argument_name); + } + else + strm.Printf (" -%c", full_options_table[i].short_option); + } + else + { + if (full_options_table[i].option_has_arg == required_argument) + strm.Printf (" [-%c %s]", full_options_table[i].short_option, + full_options_table[i].argument_name); + else if (full_options_table[i].option_has_arg == optional_argument) + strm.Printf (" [-%c [%s]]", full_options_table[i].short_option, + full_options_table[i].argument_name); + else + strm.Printf (" [-%c]", full_options_table[i].short_option); + } } - else - strm.Printf (" -%c", full_options_table[i].short_option); - } - else - { - if (full_options_table[i].option_has_arg == required_argument) - strm.Printf (" [-%c %s]", full_options_table[i].short_option, - full_options_table[i].argument_name); - else if (full_options_table[i].option_has_arg == optional_argument) - strm.Printf (" [-%c [%s]]", full_options_table[i].short_option, - full_options_table[i].argument_name); - else - strm.Printf (" [-%c]", full_options_table[i].short_option); } } - strm.Printf ("\n\n"); // Now print out all the detailed information about the various options: long form, short form and help text: Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=106020&r1=106019&r2=106020&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Tue Jun 15 13:47:14 2010 @@ -49,28 +49,28 @@ static lldb::OptionDefinition g_options[] = { - { 0, true, "help", 'h', no_argument, NULL, NULL, NULL, + { LLDB_OPT_SET_1, true, "help", 'h', no_argument, NULL, NULL, NULL, "Prints out the usage information for the LLDB debugger." }, - { 1, true, "version", 'v', no_argument, NULL, NULL, NULL, + { LLDB_OPT_SET_2, true, "version", 'v', no_argument, NULL, NULL, NULL, "Prints out the current version number of the LLDB debugger." }, - { 2, false, "file", 'f', required_argument, NULL, NULL, "", - "Tells the debugger to use the file as the program to be debugged." }, - - { 2, false, "arch", 'a', required_argument, NULL, NULL, "", + { LLDB_OPT_SET_3, false, "arch", 'a', required_argument, NULL, NULL, "", "Tells the debugger to use the specified architecture when starting and running the program. must be one of the architectures for which the program was compiled." }, - { 2, false, "script-language",'l', required_argument, NULL, NULL, "", + { LLDB_OPT_SET_3 | LLDB_OPT_SET_4, false, "script-language",'l', required_argument, NULL, NULL, "", "Tells the debugger to use the specified scripting language for user-defined scripts, rather than the default. Valid scripting languages that can be specified include Python, Perl, Ruby and Tcl. Currently only the Python extensions have been implemented." }, - { 2, false, "debug", 'd', no_argument, NULL, NULL, NULL, + { LLDB_OPT_SET_3 | LLDB_OPT_SET_4, false, "debug", 'd', no_argument, NULL, NULL, NULL, "Tells the debugger to print out extra information for debugging itself." }, - { 2, false, "source", 's', required_argument, NULL, NULL, "", + { LLDB_OPT_SET_3 | LLDB_OPT_SET_4, false, "source", 's', required_argument, NULL, NULL, "", "Tells the debugger to read in and execute the file , which should contain lldb commands." }, - { 3, false, "crash-log", 'c', required_argument, NULL, NULL, "", + { LLDB_OPT_SET_3, false, "file", 'f', required_argument, NULL, NULL, "", + "Tells the debugger to use the file as the program to be debugged." }, + + { LLDB_OPT_SET_4, false, "crash-log", 'c', required_argument, NULL, NULL, "", "Load executable images from a crash log for symbolication." }, { 0, false, NULL, 0, 0, NULL, NULL, NULL, NULL } @@ -172,7 +172,7 @@ const char *name = "lldb"; char spaces[screen_width+1]; uint32_t i; - + for (i = 0; i < screen_width; ++i) spaces[i] = ' '; spaces[i] = '\n'; @@ -188,39 +188,63 @@ // [options-for-level-1] // etc. - uint32_t usage_level = 0; uint32_t num_options; - - for (num_options = 0; option_table[num_options].long_option != NULL; ++num_options); - - for (i = 0; i < num_options; ++i) + uint32_t num_option_sets = 0; + + for (num_options = 0; option_table[num_options].long_option != NULL; ++num_options) { - if (i == 0 || option_table[i].usage_level > usage_level) + uint32_t this_usage_mask = option_table[num_options].usage_mask; + if (this_usage_mask == LLDB_OPT_SET_ALL) { - // Start a new level. - usage_level = option_table[i].usage_level; - if (usage_level > 0) - fprintf (out, "\n\n"); - fprintf (out, "%s%s", spaces_string.substr(0, indent_level).c_str(), name); + if (num_option_sets == 0) + num_option_sets = 1; } - - if (option_table[i].required) + else { - if (option_table[i].option_has_arg == required_argument) - fprintf (out, " -%c %s", option_table[i].short_option, option_table[i].argument_name); - else if (option_table[i].option_has_arg == optional_argument) - fprintf (out, " -%c [%s]", option_table[i].short_option, option_table[i].argument_name); - else - fprintf (out, " -%c", option_table[i].short_option); + for (int j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++) + { + if (this_usage_mask & 1 << j) + { + if (num_option_sets <= j) + num_option_sets = j + 1; + } + } } - else + } + + for (uint32_t opt_set = 0; opt_set < num_option_sets; opt_set++) + { + uint32_t opt_set_mask; + + opt_set_mask = 1 << opt_set; + + if (opt_set > 0) + fprintf (out, "\n"); + fprintf (out, "%s%s", spaces_string.substr(0, indent_level).c_str(), name); + + for (uint32_t i = 0; i < num_options; ++i) { - if (option_table[i].option_has_arg == required_argument) - fprintf (out, " [-%c %s]", option_table[i].short_option, option_table[i].argument_name); - else if (option_table[i].option_has_arg == optional_argument) - fprintf (out, " [-%c [%s]]", option_table[i].short_option, option_table[i].argument_name); - else - fprintf (out, " [-%c]", option_table[i].short_option); + if (option_table[i].usage_mask & opt_set_mask) + { + if (option_table[i].required) + { + if (option_table[i].option_has_arg == required_argument) + fprintf (out, " -%c %s", option_table[i].short_option, option_table[i].argument_name); + else if (option_table[i].option_has_arg == optional_argument) + fprintf (out, " -%c [%s]", option_table[i].short_option, option_table[i].argument_name); + else + fprintf (out, " -%c", option_table[i].short_option); + } + else + { + if (option_table[i].option_has_arg == required_argument) + fprintf (out, " [-%c %s]", option_table[i].short_option, option_table[i].argument_name); + else if (option_table[i].option_has_arg == optional_argument) + fprintf (out, " [-%c [%s]]", option_table[i].short_option, option_table[i].argument_name); + else + fprintf (out, " [-%c]", option_table[i].short_option); + } + } } } @@ -239,7 +263,7 @@ indent_level += 5; - for (i = 0; i < num_options; ++i) + for (uint32_t i = 0; i < num_options; ++i) { // Only print this option if we haven't already seen it. pos = options_seen.find (option_table[i].short_option); @@ -555,27 +579,40 @@ ResetOptionValues (); - if (argc == 2 && *(argv[1]) != '-') + SBCommandReturnObject result; + + SBError error = ParseOptions (m_option_data, argc, argv); + if (error.Fail()) { - m_option_data.m_filename = argv[1]; + const char *error_cstr = error.GetCString (); + if (error_cstr) + ::fprintf (err_fh, "error: %s\n", error_cstr); + valid = false; } - else + + // If there is a trailing argument, it is the filename. + if (optind == argc - 1) { - SBCommandReturnObject result; - - SBError error = ParseOptions (m_option_data, argc, argv); - if (error.Fail()) + if (m_option_data.m_filename.empty()) { - const char *error_cstr = error.GetCString (); - if (error_cstr) - ::fprintf (err_fh, "error: %s\n", error_cstr); + m_option_data.m_filename = argv[optind]; + } + else + { + ::fprintf (err_fh, "error: don't provide a file both on in the -f option and as an argument."); + valid = false; } - } - - // Check to see if they just invoked the debugger with a filename. - - if (m_option_data.m_print_help) + } + else if (optind < argc - 1) + { + // Trailing extra arguments... + ::fprintf (err_fh, "error: trailing extra arguments - only one the filename is allowed."); + valid = false; + + } + + if (!valid || m_option_data.m_print_help) { ShowUsage (out_fh, g_options, m_option_data); valid = false; From jingham at apple.com Tue Jun 15 13:50:33 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 15 Jun 2010 18:50:33 -0000 Subject: [Lldb-commits] [lldb] r106022 - /lldb/trunk/include/lldb/lldb-types.h Message-ID: <20100615185033.0EEF02A6C12C@llvm.org> Author: jingham Date: Tue Jun 15 13:50:32 2010 New Revision: 106022 URL: http://llvm.org/viewvc/llvm-project?rev=106022&view=rev Log: Fix a typo in a comment... Modified: lldb/trunk/include/lldb/lldb-types.h Modified: lldb/trunk/include/lldb/lldb-types.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-types.h?rev=106022&r1=106021&r2=106022&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-types.h (original) +++ lldb/trunk/include/lldb/lldb-types.h Tue Jun 15 13:50:32 2010 @@ -131,7 +131,7 @@ typedef struct { - uint32_t usage_mask; // Used to mark options that can be used together. If 1 << n && usage_mask != 0 + uint32_t usage_mask; // Used to mark options that can be used together. If (1 << n & usage_mask) != 0 // then this option belongs to option set n. bool required; // This option is required (in the current usage level) CONST_CHAR_PTR long_option; // Full name for this option. From jingham at apple.com Tue Jun 15 14:49:27 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 15 Jun 2010 19:49:27 -0000 Subject: [Lldb-commits] [lldb] r106034 - in /lldb/trunk: include/lldb/Core/ include/lldb/Interpreter/ lldb.xcodeproj/ source/ source/API/ source/Breakpoint/ source/Commands/ source/Core/ source/Interpreter/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/gdb-remote/ source/Plugins/SymbolFile/DWARF/ Message-ID: <20100615194928.6A1C92A6C12C@llvm.org> Author: jingham Date: Tue Jun 15 14:49:27 2010 New Revision: 106034 URL: http://llvm.org/viewvc/llvm-project?rev=106034&view=rev Log: Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong. Added: lldb/trunk/include/lldb/Interpreter/Args.h - copied, changed from r106033, lldb/trunk/include/lldb/Core/Args.h lldb/trunk/include/lldb/Interpreter/Options.h - copied, changed from r106033, lldb/trunk/include/lldb/Core/Options.h lldb/trunk/source/Interpreter/Args.cpp - copied, changed from r106033, lldb/trunk/source/Core/Args.cpp lldb/trunk/source/Interpreter/Options.cpp - copied, changed from r106033, lldb/trunk/source/Core/Options.cpp Removed: lldb/trunk/include/lldb/Core/Args.h lldb/trunk/include/lldb/Core/Options.h lldb/trunk/source/Core/Args.cpp lldb/trunk/source/Core/Options.cpp Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h lldb/trunk/include/lldb/Interpreter/CommandObject.h lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h lldb/trunk/include/lldb/Interpreter/StateVariable.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBCommandInterpreter.cpp lldb/trunk/source/API/SBDebugger.cpp lldb/trunk/source/API/SBProcess.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Breakpoint/BreakpointIDList.cpp lldb/trunk/source/Commands/CommandCompletions.cpp lldb/trunk/source/Commands/CommandObjectAdd.cpp lldb/trunk/source/Commands/CommandObjectAlias.cpp lldb/trunk/source/Commands/CommandObjectApropos.cpp lldb/trunk/source/Commands/CommandObjectArgs.cpp lldb/trunk/source/Commands/CommandObjectArgs.h lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h lldb/trunk/source/Commands/CommandObjectCall.cpp lldb/trunk/source/Commands/CommandObjectCall.h lldb/trunk/source/Commands/CommandObjectDisassemble.cpp lldb/trunk/source/Commands/CommandObjectDisassemble.h lldb/trunk/source/Commands/CommandObjectExpression.cpp lldb/trunk/source/Commands/CommandObjectExpression.h lldb/trunk/source/Commands/CommandObjectFile.cpp lldb/trunk/source/Commands/CommandObjectFile.h lldb/trunk/source/Commands/CommandObjectFrame.cpp lldb/trunk/source/Commands/CommandObjectFrame.h lldb/trunk/source/Commands/CommandObjectHelp.cpp lldb/trunk/source/Commands/CommandObjectImage.cpp lldb/trunk/source/Commands/CommandObjectLog.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectMultiword.cpp lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Commands/CommandObjectRegister.cpp lldb/trunk/source/Commands/CommandObjectSource.cpp lldb/trunk/source/Commands/CommandObjectSourceFile.cpp lldb/trunk/source/Commands/CommandObjectSourceFile.h lldb/trunk/source/Commands/CommandObjectSyntax.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Commands/CommandObjectTarget.h lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Commands/CommandObjectTranslate.cpp lldb/trunk/source/Commands/CommandObjectVariable.cpp lldb/trunk/source/Core/ConnectionFileDescriptor.cpp lldb/trunk/source/Core/Scalar.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/CommandObject.cpp lldb/trunk/source/Interpreter/CommandObjectScript.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp lldb/trunk/source/lldb-log.cpp Removed: lldb/trunk/include/lldb/Core/Args.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Args.h?rev=106033&view=auto ============================================================================== --- lldb/trunk/include/lldb/Core/Args.h (original) +++ lldb/trunk/include/lldb/Core/Args.h (removed) @@ -1,368 +0,0 @@ -//===-- Args.h --------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Command_h_ -#define liblldb_Command_h_ - -// C Includes -#include - -// C++ Includes -#include -#include -#include -#include - -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" -#include "lldb/Core/Error.h" -#include "lldb/lldb-types.h" - -namespace lldb_private { - -typedef std::pair OptionArgPair; -typedef std::vector OptionArgVector; -typedef lldb::SharedPtr::Type OptionArgVectorSP; - -struct OptionArgElement -{ - OptionArgElement (int defs_index, int pos, int arg_pos) : - opt_defs_index(defs_index), - opt_pos (pos), - opt_arg_pos (arg_pos) - { - } - - int opt_defs_index; - int opt_pos; - int opt_arg_pos; -}; - -typedef std::vector OptionElementVector; - -//---------------------------------------------------------------------- -/// @class Args Args.h "lldb/Core/Args.h" -/// @brief A command line argument class. -/// -/// The Args class is designed to be fed a command line. The -/// command line is copied into an internal buffer and then split up -/// into arguments. Arguments are space delimited if there are no quotes -/// (single, double, or backtick quotes) surrounding the argument. Spaces -/// can be escaped using a \ character to avoid having to surround an -/// argument that contains a space with quotes. -//---------------------------------------------------------------------- -class Args -{ -public: - - //------------------------------------------------------------------ - /// Construct with an option command string. - /// - /// @param[in] command - /// A NULL terminated command that will be copied and split up - /// into arguments. - /// - /// @see Args::SetCommandString(const char *) - //------------------------------------------------------------------ - Args (const char *command = NULL); - - Args (const char *command, size_t len); - - //------------------------------------------------------------------ - /// Destructor. - //------------------------------------------------------------------ - ~Args(); - - //------------------------------------------------------------------ - /// Dump all arguments to the stream \a s. - /// - /// @param[in] s - /// The stream to which to dump all arguments in the argument - /// vector. - //------------------------------------------------------------------ - void - Dump (Stream *s); - - //------------------------------------------------------------------ - /// Sets the command string contained by this object. - /// - /// The command string will be copied and split up into arguments - /// that can be accessed via the accessor functions. - /// - /// @param[in] command - /// A NULL terminated command that will be copied and split up - /// into arguments. - /// - /// @see Args::GetArgumentCount() const - /// @see Args::GetArgumentAtIndex (size_t) const - /// @see Args::GetArgumentVector () - /// @see Args::Shift () - /// @see Args::Unshift (const char *) - //------------------------------------------------------------------ - void - SetCommandString (const char *command); - - void - SetCommandString (const char *command, size_t len); - - bool - GetCommandString (std::string &command); - - //------------------------------------------------------------------ - /// Gets the number of arguments left in this command object. - /// - /// @return - /// The number or arguments in this object. - //------------------------------------------------------------------ - size_t - GetArgumentCount () const; - - //------------------------------------------------------------------ - /// Gets the NULL terminated C string argument pointer for the - /// argument at index \a idx. - /// - /// @return - /// The NULL terminated C string argument pointer if \a idx is a - /// valid argument index, NULL otherwise. - //------------------------------------------------------------------ - const char * - GetArgumentAtIndex (size_t idx) const; - - char - GetArgumentQuoteCharAtIndex (size_t idx) const; - - //------------------------------------------------------------------ - /// Gets the argument vector. - /// - /// The value returned by this function can be used by any function - /// that takes and vector. The return value is just like \a argv - /// in the standard C entry point function: - /// \code - /// int main (int argc, const char **argv); - /// \endcode - /// - /// @return - /// An array of NULL terminated C string argument pointers that - /// also has a terminating NULL C string pointer - //------------------------------------------------------------------ - char ** - GetArgumentVector (); - - //------------------------------------------------------------------ - /// Gets the argument vector. - /// - /// The value returned by this function can be used by any function - /// that takes and vector. The return value is just like \a argv - /// in the standard C entry point function: - /// \code - /// int main (int argc, const char **argv); - /// \endcode - /// - /// @return - /// An array of NULL terminate C string argument pointers that - /// also has a terminating NULL C string pointer - //------------------------------------------------------------------ - const char ** - GetConstArgumentVector () const; - - - //------------------------------------------------------------------ - /// Appends a new argument to the end of the list argument list. - /// - /// @param[in] arg_cstr - /// The new argument as a NULL terminated C string. - /// - /// @param[in] quote_char - /// If the argument was originally quoted, put in the quote char here. - /// - /// @return - /// The NULL terminated C string of the copy of \a arg_cstr. - //------------------------------------------------------------------ - const char * - AppendArgument (const char *arg_cstr, char quote_char = '\0'); - - void - AppendArguments (const Args &rhs); - //------------------------------------------------------------------ - /// Insert the argument value at index \a idx to \a arg_cstr. - /// - /// @param[in] idx - /// The index of where to insert the argument. - /// - /// @param[in] arg_cstr - /// The new argument as a NULL terminated C string. - /// - /// @param[in] quote_char - /// If the argument was originally quoted, put in the quote char here. - /// - /// @return - /// The NULL terminated C string of the copy of \a arg_cstr. - //------------------------------------------------------------------ - const char * - InsertArgumentAtIndex (size_t idx, const char *arg_cstr, char quote_char = '\0'); - - //------------------------------------------------------------------ - /// Replaces the argument value at index \a idx to \a arg_cstr - /// if \a idx is a valid argument index. - /// - /// @param[in] idx - /// The index of the argument that will have its value replaced. - /// - /// @param[in] arg_cstr - /// The new argument as a NULL terminated C string. - /// - /// @param[in] quote_char - /// If the argument was originally quoted, put in the quote char here. - /// - /// @return - /// The NULL terminated C string of the copy of \a arg_cstr if - /// \a idx was a valid index, NULL otherwise. - //------------------------------------------------------------------ - const char * - ReplaceArgumentAtIndex (size_t idx, const char *arg_cstr, char quote_char = '\0'); - - //------------------------------------------------------------------ - /// Deletes the argument value at index - /// if \a idx is a valid argument index. - /// - /// @param[in] idx - /// The index of the argument that will have its value replaced. - /// - //------------------------------------------------------------------ - void - DeleteArgumentAtIndex (size_t idx); - - //------------------------------------------------------------------ - /// Sets the argument vector value, optionally copying all - /// arguments into an internal buffer. - /// - /// Sets the arguments to match those found in \a argv. All argument - /// strings will be copied into an internal buffers. - // - // FIXME: Handle the quote character somehow. - //------------------------------------------------------------------ - void - SetArguments (int argc, const char **argv); - - //------------------------------------------------------------------ - /// Shifts the first argument C string value of the array off the - /// argument array. - /// - /// The string value will be freed, so a copy of the string should - /// be made by calling Args::GetArgumentAtIndex (size_t) const - /// first and copying the returned value before calling - /// Args::Shift(). - /// - /// @see Args::GetArgumentAtIndex (size_t) const - //------------------------------------------------------------------ - void - Shift (); - - //------------------------------------------------------------------ - /// Inserts a class owned copy of \a arg_cstr at the beginning of - /// the argument vector. - /// - /// A copy \a arg_cstr will be made. - /// - /// @param[in] arg_cstr - /// The argument to push on the front the the argument stack. - /// - /// @param[in] quote_char - /// If the argument was originally quoted, put in the quote char here. - /// - /// @return - /// A pointer to the copy of \a arg_cstr that was made. - //------------------------------------------------------------------ - const char * - Unshift (const char *arg_cstr, char quote_char = '\0'); - - //------------------------------------------------------------------ - /// Parse the arguments in the contained arguments. - /// - /// The arguments that are consumed by the argument parsing process - /// will be removed from the argument vector. The arguements that - /// get processed start at the second argument. The first argument - /// is assumed to be the command and will not be touched. - /// - /// @see class Options - //------------------------------------------------------------------ - Error - ParseOptions (Options &options); - - // The following works almost identically to ParseOptions, except that no option is required to have arguments, - // and it builds up the option_arg_vector as it parses the options. - - void - ParseAliasOptions (Options &options, CommandReturnObject &result, OptionArgVector *option_arg_vector); - - void - ParseArgsForCompletion (Options &options, OptionElementVector &option_element_vector); - - //------------------------------------------------------------------ - // Clear the arguments. - // - // For re-setting or blanking out the list of arguments. - //------------------------------------------------------------------ - void - Clear (); - - static int32_t - StringToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static uint32_t - StringToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static int64_t - StringToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static uint64_t - StringToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = NULL); - - static lldb::addr_t - StringToAddress (const char *s, lldb::addr_t fail_value = LLDB_INVALID_ADDRESS, bool *success_ptr = NULL); - - static bool - StringToBoolean (const char *s, bool fail_value, bool *success_ptr); - - static int32_t - StringToOptionEnum (const char *s, lldb::OptionEnumValueElement *enum_values, int32_t fail_value, bool *success_ptr); - - static lldb::ScriptLanguage - StringToScriptLanguage (const char *s, lldb::ScriptLanguage fail_value, bool *success_ptr); - - static Error - StringToFormat (const char *s, lldb::Format &format); - - // This one isn't really relevant to Arguments per se, but we're using the Args as a - // general strings container, so... - void - LongestCommonPrefix (std::string &common_prefix); - -protected: - //------------------------------------------------------------------ - // Classes that inherit from Args can see and modify these - //------------------------------------------------------------------ - typedef std::list arg_sstr_collection; - typedef std::vector arg_cstr_collection; - typedef std::vector arg_quote_char_collection; - arg_sstr_collection m_args; - arg_cstr_collection m_argv; ///< The current argument vector. - arg_quote_char_collection m_args_quote_char; - - void - UpdateArgsAfterOptionParsing (); - - void - UpdateArgvFromArgs (); -}; - -} // namespace lldb_private - -#endif // liblldb_Command_h_ Removed: lldb/trunk/include/lldb/Core/Options.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Options.h?rev=106033&view=auto ============================================================================== --- lldb/trunk/include/lldb/Core/Options.h (original) +++ lldb/trunk/include/lldb/Core/Options.h (removed) @@ -1,299 +0,0 @@ -//===-- Options.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Options_h_ -#define liblldb_Options_h_ - -// C Includes -#include - -// C++ Includes -#include -#include - -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" -#include "lldb/lldb-defines.h" -#include "lldb/Core/Args.h" - -namespace lldb_private { - -//---------------------------------------------------------------------- -/// @class Options Options.h "lldb/Core/Options.h" -/// @brief A command line option parsing protocol class. -/// -/// Options is designed to be subclassed to contain all needed -/// options for a given command. The options can be parsed by calling: -/// \code -/// Error Args::ParseOptions (Options &); -/// \endcode -/// -/// The options are specified using the format defined for the libc -/// options parsing function getopt_long: -/// \code -/// #include -/// int getopt_long(int argc, char * const *argv, const char *optstring, const struct option *longopts, int *longindex); -/// \endcode -/// -/// Example code: -/// \code -/// #include -/// #include -/// -/// class CommandOptions : public Options -/// { -/// public: -/// virtual struct option * -/// GetLongOptions() { -/// return g_options; -/// } -/// -/// virtual Error -/// SetOptionValue (int option_idx, int option_val, const char *option_arg) -/// { -/// Error error; -/// switch (option_val) -/// { -/// case 'g': debug = true; break; -/// case 'v': verbose = true; break; -/// case 'l': log_file = option_arg; break; -/// case 'f': log_flags = strtoull(option_arg, NULL, 0); break; -/// default: -/// error.SetErrorStringWithFormat("unrecognized short option %c", option_val); -/// break; -/// } -/// -/// return error; -/// } -/// -/// CommandOptions () : debug (true), verbose (false), log_file (), log_flags (0) -/// {} -/// -/// bool debug; -/// bool verbose; -/// std::string log_file; -/// uint32_t log_flags; -/// -/// static struct option g_options[]; -/// -/// }; -/// -/// struct option CommandOptions::g_options[] = -/// { -/// { "debug", no_argument, NULL, 'g' }, -/// { "log-file", required_argument, NULL, 'l' }, -/// { "log-flags", required_argument, NULL, 'f' }, -/// { "verbose", no_argument, NULL, 'v' }, -/// { NULL, 0, NULL, 0 } -/// }; -/// -/// int main (int argc, const char **argv, const char **envp) -/// { -/// CommandOptions options; -/// Args main_command; -/// main_command.SetArguments(argc, argv, false); -/// main_command.ParseOptions(options); -/// -/// if (options.verbose) -/// { -/// std::cout << "verbose is on" << std::endl; -/// } -/// } -/// \endcode -//---------------------------------------------------------------------- -class Options -{ -public: - - Options (); - - virtual - ~Options (); - - void - BuildGetoptTable (); - - void - BuildValidOptionSets (); - - uint32_t - NumCommandOptions (); - - //------------------------------------------------------------------ - /// Get the option definitions to use when parsing Args options. - /// - /// @see Args::ParseOptions (Options&) - /// @see man getopt_long - //------------------------------------------------------------------ - struct option * - GetLongOptions (); - - // This gets passed the short option as an integer... - void - OptionSeen (int short_option); - - bool - VerifyOptions (CommandReturnObject &result); - - // Verify that the options given are in the options table and can be used together, but there may be - // some required options that are missing (used to verify options that get folded into command aliases). - - bool - VerifyPartialOptions (CommandReturnObject &result); - -// void -// BuildAliasOptions (OptionArgVector *option_arg_vector, Args args); - - void - OutputFormattedUsageText (Stream &strm, - const char *text, - uint32_t output_max_columns); - - void - GenerateOptionUsage (Stream &strm, - CommandObject *cmd, - const char *program_name = NULL); - - // The following two pure virtual functions must be defined by every class that inherits from - // this class. - - virtual const lldb::OptionDefinition* - GetDefinitions () { return NULL; }; - - virtual void - ResetOptionValues (); - - //------------------------------------------------------------------ - /// Set the value of an option. - /// - /// @param[in] option_idx - /// The index into the "struct option" array that was returned - /// by Options::GetLongOptions(). - /// - /// @param[in] option_arg - /// The argument value for the option that the user entered, or - /// NULL if there is no argument for the current option. - /// - /// - /// @see Args::ParseOptions (Options&) - /// @see man getopt_long - //------------------------------------------------------------------ - virtual Error - SetOptionValue (int option_idx, const char *option_arg) = 0; - - //------------------------------------------------------------------ - /// Handles the generic bits of figuring out whether we are in an option, and if so completing - /// it. - /// - /// @param[in] input - /// The command line parsed into words - /// - /// @param[in] cursor_index - /// The index in \ainput of the word in which the cursor lies. - /// - /// @param[in] char_pos - /// The character position of the cursor in its argument word. - /// - /// @param[in] match_start_point - /// @param[in] match_return_elements - /// See CommandObject::HandleCompletions for a description of how these work. - /// - /// @param[in] interpreter - /// The interpreter that's doing the completing. - /// - /// @param[out] matches - /// The array of matches returned. - /// - /// FIXME: This is the wrong return value, since we also need to make a distinction between - /// total number of matches, and the window the user wants returned. - /// - /// @return - /// \btrue if we were in an option, \bfalse otherwise. - //------------------------------------------------------------------ - bool - HandleOptionCompletion (Args &input, - OptionElementVector &option_map, - int cursor_index, - int char_pos, - int match_start_point, - int max_return_elements, - lldb_private::CommandInterpreter *interpreter, - lldb_private::StringList &matches); - - //------------------------------------------------------------------ - /// Handles the generic bits of figuring out whether we are in an option, and if so completing - /// it. - /// - /// @param[in] input - /// The command line parsed into words - /// - /// @param[in] cursor_index - /// The index in \ainput of the word in which the cursor lies. - /// - /// @param[in] char_pos - /// The character position of the cursor in its argument word. - /// - /// @param[in] opt_element_vector - /// The results of the options parse of \a input. - /// - /// @param[in] opt_element_index - /// The position in \a opt_element_vector of the word in \a input containing the cursor. - /// - /// @param[in] match_start_point - /// @param[in] match_return_elements - /// See CommandObject::HandleCompletions for a description of how these work. - /// - /// @param[in] interpreter - /// The interpreter that's doing the completing. - /// - /// @param[out] matches - /// The array of matches returned. - /// - /// FIXME: This is the wrong return value, since we also need to make a distinction between - /// total number of matches, and the window the user wants returned. - /// - /// @return - /// \btrue if we were in an option, \bfalse otherwise. - //------------------------------------------------------------------ - virtual bool - HandleOptionArgumentCompletion (Args &input, - int cursor_index, - int char_pos, - OptionElementVector &opt_element_vector, - int opt_element_index, - int match_start_point, - int max_return_elements, - CommandInterpreter *interpreter, - StringList &matches); - -protected: - // This is a set of options expressed as indexes into the options table for this Option. - typedef std::set OptionSet; - - std::vector m_getopt_table; - OptionSet m_seen_options; - std::vector m_required_options; - std::vector m_optional_options; - - - - bool - IsASubset (const OptionSet& set_a, const OptionSet& set_b); - - size_t - OptionsSetDiff (const OptionSet &set_a, const OptionSet &set_b, OptionSet &diffs); - - void - OptionsSetUnion (const OptionSet &set_a, const OptionSet &set_b, OptionSet &union_set); -}; - -} // namespace lldb_private - -#endif // liblldb_Options_h_ Copied: lldb/trunk/include/lldb/Interpreter/Args.h (from r106033, lldb/trunk/include/lldb/Core/Args.h) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?p2=lldb/trunk/include/lldb/Interpreter/Args.h&p1=lldb/trunk/include/lldb/Core/Args.h&r1=106033&r2=106034&rev=106034&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Args.h (original) +++ lldb/trunk/include/lldb/Interpreter/Args.h Tue Jun 15 14:49:27 2010 @@ -48,7 +48,7 @@ typedef std::vector OptionElementVector; //---------------------------------------------------------------------- -/// @class Args Args.h "lldb/Core/Args.h" +/// @class Args Args.h "lldb/Interpreter/Args.h" /// @brief A command line argument class. /// /// The Args class is designed to be fed a command line. The Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Tue Jun 15 14:49:27 2010 @@ -22,7 +22,7 @@ #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Interpreter/StateVariable.h" #include "lldb/Core/Event.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/StringList.h" namespace lldb_private { Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Tue Jun 15 14:49:27 2010 @@ -16,7 +16,7 @@ #include #include "lldb/lldb-private.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/StringList.h" #include "lldb/Core/Flags.h" Modified: lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h (original) +++ lldb/trunk/include/lldb/Interpreter/CommandObjectCrossref.h Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" namespace lldb_private { Copied: lldb/trunk/include/lldb/Interpreter/Options.h (from r106033, lldb/trunk/include/lldb/Core/Options.h) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?p2=lldb/trunk/include/lldb/Interpreter/Options.h&p1=lldb/trunk/include/lldb/Core/Options.h&r1=106033&r2=106034&rev=106034&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Options.h (original) +++ lldb/trunk/include/lldb/Interpreter/Options.h Tue Jun 15 14:49:27 2010 @@ -21,12 +21,12 @@ // Project includes #include "lldb/lldb-private.h" #include "lldb/lldb-defines.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" namespace lldb_private { //---------------------------------------------------------------------- -/// @class Options Options.h "lldb/Core/Options.h" +/// @class Options Options.h "lldb/Interpreter/Options.h" /// @brief A command line option parsing protocol class. /// /// Options is designed to be subclassed to contain all needed Modified: lldb/trunk/include/lldb/Interpreter/StateVariable.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/StateVariable.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/StateVariable.h (original) +++ lldb/trunk/include/lldb/Interpreter/StateVariable.h Tue Jun 15 14:49:27 2010 @@ -16,7 +16,7 @@ // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" namespace lldb_private { Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jun 15 14:49:27 2010 @@ -623,7 +623,7 @@ 26BC7D5010F1B77400F91463 /* Address.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Address.h; path = include/lldb/Core/Address.h; sourceTree = ""; }; 26BC7D5110F1B77400F91463 /* AddressRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AddressRange.h; path = include/lldb/Core/AddressRange.h; sourceTree = ""; }; 26BC7D5210F1B77400F91463 /* ArchSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ArchSpec.h; path = include/lldb/Core/ArchSpec.h; sourceTree = ""; }; - 26BC7D5310F1B77400F91463 /* Args.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Args.h; path = include/lldb/Core/Args.h; sourceTree = ""; }; + 26BC7D5310F1B77400F91463 /* Args.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Args.h; path = include/lldb/Interpreter/Args.h; sourceTree = ""; }; 26BC7D5410F1B77400F91463 /* Broadcaster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Broadcaster.h; path = include/lldb/Core/Broadcaster.h; sourceTree = ""; }; 26BC7D5510F1B77400F91463 /* ClangForward.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangForward.h; path = include/lldb/Core/ClangForward.h; sourceTree = ""; }; 26BC7D5610F1B77400F91463 /* Communication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Communication.h; path = include/lldb/Core/Communication.h; sourceTree = ""; }; @@ -649,7 +649,7 @@ 26BC7D6A10F1B77400F91463 /* Module.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Module.h; path = include/lldb/Core/Module.h; sourceTree = ""; }; 26BC7D6B10F1B77400F91463 /* ModuleChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ModuleChild.h; path = include/lldb/Core/ModuleChild.h; sourceTree = ""; }; 26BC7D6C10F1B77400F91463 /* ModuleList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ModuleList.h; path = include/lldb/Core/ModuleList.h; sourceTree = ""; }; - 26BC7D6D10F1B77400F91463 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Options.h; path = include/lldb/Core/Options.h; sourceTree = ""; }; + 26BC7D6D10F1B77400F91463 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Options.h; path = include/lldb/Interpreter/Options.h; sourceTree = ""; }; 26BC7D7010F1B77400F91463 /* PluginInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PluginInterface.h; path = include/lldb/Core/PluginInterface.h; sourceTree = ""; }; 26BC7D7110F1B77400F91463 /* PluginManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PluginManager.h; path = include/lldb/Core/PluginManager.h; sourceTree = ""; }; 26BC7D7310F1B77400F91463 /* RegularExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegularExpression.h; path = include/lldb/Core/RegularExpression.h; sourceTree = ""; }; @@ -746,7 +746,7 @@ 26BC7E6910F1B85900F91463 /* Address.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Address.cpp; path = source/Core/Address.cpp; sourceTree = ""; }; 26BC7E6A10F1B85900F91463 /* AddressRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AddressRange.cpp; path = source/Core/AddressRange.cpp; sourceTree = ""; }; 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ArchSpec.cpp; path = source/Core/ArchSpec.cpp; sourceTree = ""; }; - 26BC7E6C10F1B85900F91463 /* Args.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Args.cpp; path = source/Core/Args.cpp; sourceTree = ""; }; + 26BC7E6C10F1B85900F91463 /* Args.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Args.cpp; path = source/Interpreter/Args.cpp; sourceTree = ""; }; 26BC7E6D10F1B85900F91463 /* Broadcaster.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Broadcaster.cpp; path = source/Core/Broadcaster.cpp; sourceTree = ""; }; 26BC7E6E10F1B85900F91463 /* Communication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Communication.cpp; path = source/Core/Communication.cpp; sourceTree = ""; }; 26BC7E6F10F1B85900F91463 /* Connection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Connection.cpp; path = source/Core/Connection.cpp; sourceTree = ""; }; @@ -770,7 +770,7 @@ 26BC7E8110F1B85900F91463 /* Module.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Module.cpp; path = source/Core/Module.cpp; sourceTree = ""; }; 26BC7E8210F1B85900F91463 /* ModuleChild.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleChild.cpp; path = source/Core/ModuleChild.cpp; sourceTree = ""; }; 26BC7E8310F1B85900F91463 /* ModuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ModuleList.cpp; path = source/Core/ModuleList.cpp; sourceTree = ""; }; - 26BC7E8610F1B85900F91463 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Options.cpp; path = source/Core/Options.cpp; sourceTree = ""; }; + 26BC7E8610F1B85900F91463 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Options.cpp; path = source/Interpreter/Options.cpp; sourceTree = ""; }; 26BC7E8A10F1B85900F91463 /* PluginManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginManager.cpp; path = source/Core/PluginManager.cpp; sourceTree = ""; }; 26BC7E8C10F1B85900F91463 /* RegularExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegularExpression.cpp; path = source/Core/RegularExpression.cpp; sourceTree = ""; }; 26BC7E8D10F1B85900F91463 /* Scalar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Scalar.cpp; path = source/Core/Scalar.cpp; sourceTree = ""; }; @@ -1556,8 +1556,6 @@ 9AC7034411752C790086C050 /* AddressResolverName.cpp */, 26BC7D5210F1B77400F91463 /* ArchSpec.h */, 26BC7E6B10F1B85900F91463 /* ArchSpec.cpp */, - 26BC7D5310F1B77400F91463 /* Args.h */, - 26BC7E6C10F1B85900F91463 /* Args.cpp */, 26A0604711A5BC7A00F75969 /* Baton.h */, 26A0604811A5D03C00F75969 /* Baton.cpp */, 26BC7D5410F1B77400F91463 /* Broadcaster.h */, @@ -1611,8 +1609,6 @@ 26BC7E8210F1B85900F91463 /* ModuleChild.cpp */, 26BC7D6C10F1B77400F91463 /* ModuleList.h */, 26BC7E8310F1B85900F91463 /* ModuleList.cpp */, - 26BC7D6D10F1B77400F91463 /* Options.h */, - 26BC7E8610F1B85900F91463 /* Options.cpp */, 26BC7D7010F1B77400F91463 /* PluginInterface.h */, 26BC7D7110F1B77400F91463 /* PluginManager.h */, 26BC7E8A10F1B85900F91463 /* PluginManager.cpp */, @@ -1875,6 +1871,8 @@ 26BC7DDF10F1B7E200F91463 /* Interpreter */ = { isa = PBXGroup; children = ( + 26BC7D5310F1B77400F91463 /* Args.h */, + 26BC7E6C10F1B85900F91463 /* Args.cpp */, 26A4EEB511682AAC007A372A /* LLDBWrapPython.cpp */, 4C09CB73116BD98B00C7A725 /* CommandCompletions.h */, 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */, @@ -1892,6 +1890,8 @@ 26DFBC59113B48F300DD817F /* CommandObjectRegexCommand.cpp */, 26BC7DE410F1B7F900F91463 /* CommandReturnObject.h */, 26BC7F0A10F1B8DD00F91463 /* CommandReturnObject.cpp */, + 26BC7D6D10F1B77400F91463 /* Options.h */, + 26BC7E8610F1B85900F91463 /* Options.cpp */, 26BC7DE510F1B7F900F91463 /* ScriptInterpreter.h */, 9A82010B10FFB49800182560 /* ScriptInterpreter.cpp */, 9A2771FB1135A35C00E6ADB6 /* ScriptInterpreterNone.h */, Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp (original) +++ lldb/trunk/source/API/SBCommandInterpreter.cpp Tue Jun 15 14:49:27 2010 @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/lldb-types.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/SourceManager.h" #include "lldb/Core/Listener.h" #include "lldb/Interpreter/CommandInterpreter.h" Modified: lldb/trunk/source/API/SBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/API/SBDebugger.cpp (original) +++ lldb/trunk/source/API/SBDebugger.cpp Tue Jun 15 14:49:27 2010 @@ -10,7 +10,7 @@ #include "lldb/API/SBDebugger.h" #include "lldb/lldb-include.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/State.h" #include "lldb/Target/Process.h" Modified: lldb/trunk/source/API/SBProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/API/SBProcess.cpp (original) +++ lldb/trunk/source/API/SBProcess.cpp Tue Jun 15 14:49:27 2010 @@ -12,7 +12,7 @@ #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/State.h" Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Tue Jun 15 14:49:27 2010 @@ -20,7 +20,7 @@ #include "lldb/Core/Address.h" #include "lldb/Core/AddressResolver.h" #include "lldb/Core/AddressResolverName.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Disassembler.h" Modified: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointIDList.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp Tue Jun 15 14:49:27 2010 @@ -12,7 +12,7 @@ #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Target/Target.h" using namespace lldb; Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Tue Jun 15 14:49:27 2010 @@ -12,7 +12,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Core/FileSpecList.h" #include "lldb/Target/Target.h" Modified: lldb/trunk/source/Commands/CommandObjectAdd.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAdd.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectAdd.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectAdd.cpp Tue Jun 15 14:49:27 2010 @@ -14,7 +14,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandReturnObject.h" using namespace lldb; Modified: lldb/trunk/source/Commands/CommandObjectAlias.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectAlias.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectAlias.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectAlias.cpp Tue Jun 15 14:49:27 2010 @@ -15,8 +15,8 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObjectMultiword.h" -#include "lldb/Core/Args.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Args.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/CommandInterpreter.h" Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Tue Jun 15 14:49:27 2010 @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Args.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Value.h" #include "lldb/Expression/ClangExpression.h" #include "lldb/Expression/ClangExpressionVariable.h" Modified: lldb/trunk/source/Commands/CommandObjectArgs.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectArgs.h (original) +++ lldb/trunk/source/Commands/CommandObjectArgs.h Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/Language.h" namespace lldb_private { Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Jun 15 14:49:27 2010 @@ -17,7 +17,7 @@ #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointIDList.h" #include "lldb/Breakpoint/BreakpointLocation.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/RegularExpression.h" #include "lldb/Core/StreamString.h" #include "lldb/Interpreter/CommandInterpreter.h" Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Tue Jun 15 14:49:27 2010 @@ -20,7 +20,7 @@ // Project includes #include "lldb/Core/Address.h" #include "lldb/Interpreter/CommandObjectMultiword.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/STLUtils.h" namespace lldb_private { Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h Tue Jun 15 14:49:27 2010 @@ -18,7 +18,7 @@ // Project includes #include "lldb/lldb-types.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/InputReader.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectCall.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCall.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectCall.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Value.h" #include "lldb/Expression/ClangExpression.h" #include "lldb/Expression/ClangExpressionVariable.h" Modified: lldb/trunk/source/Commands/CommandObjectCall.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCall.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectCall.h (original) +++ lldb/trunk/source/Commands/CommandObjectCall.h Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/Language.h" namespace lldb_private { Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Tue Jun 15 14:49:27 2010 @@ -14,12 +14,12 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/AddressRange.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Core/Disassembler.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/SourceManager.h" #include "lldb/Target/StackFrame.h" #include "lldb/Symbol/Symbol.h" Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" namespace lldb_private { Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Value.h" #include "lldb/Core/InputReader.h" #include "lldb/Expression/ClangExpression.h" Modified: lldb/trunk/source/Commands/CommandObjectExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.h (original) +++ lldb/trunk/source/Commands/CommandObjectExpression.h Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/Language.h" #include "lldb/Target/ExecutionContext.h" Modified: lldb/trunk/source/Commands/CommandObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFile.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFile.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Timer.h" #include "lldb/Interpreter/CommandContext.h" Modified: lldb/trunk/source/Commands/CommandObjectFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFile.h (original) +++ lldb/trunk/source/Commands/CommandObjectFile.h Tue Jun 15 14:49:27 2010 @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/CommandObject.h" Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Timer.h" #include "lldb/Interpreter/CommandContext.h" Modified: lldb/trunk/source/Commands/CommandObjectFrame.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.h (original) +++ lldb/trunk/source/Commands/CommandObjectFrame.h Tue Jun 15 14:49:27 2010 @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/CommandObjectMultiword.h" Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Project includes #include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandReturnObject.h" using namespace lldb; Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectImage.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectImage.cpp Tue Jun 15 14:49:27 2010 @@ -13,9 +13,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandContext.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Core/FileSpec.h" #include "lldb/Symbol/LineTable.h" Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectLog.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectLog.cpp Tue Jun 15 14:49:27 2010 @@ -15,12 +15,12 @@ // Project includes #include "lldb/lldb-private-log.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/FileSpec.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/RegularExpression.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Jun 15 14:49:27 2010 @@ -13,10 +13,10 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/StreamString.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/CommandContext.h" Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Tue Jun 15 14:49:27 2010 @@ -14,7 +14,7 @@ // Project includes #include "lldb/Interpreter/CommandContext.h" #include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandReturnObject.h" using namespace lldb; Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Jun 15 14:49:27 2010 @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Args.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/State.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Scalar.h" #include "lldb/Interpreter/CommandContext.h" Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSource.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandContext.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectSourceFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSourceFile.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSourceFile.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandContext.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectSourceFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSourceFile.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSourceFile.h (original) +++ lldb/trunk/source/Commands/CommandObjectSourceFile.h Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/FileSpec.h" namespace lldb_private { Modified: lldb/trunk/source/Commands/CommandObjectSyntax.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectSyntax.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectSyntax.cpp Tue Jun 15 14:49:27 2010 @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Args.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Jun 15 14:49:27 2010 @@ -15,7 +15,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Timer.h" #include "lldb/Interpreter/CommandContext.h" Modified: lldb/trunk/source/Commands/CommandObjectTarget.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.h?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.h (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.h Tue Jun 15 14:49:27 2010 @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/CommandObjectMultiword.h" Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/State.h" #include "lldb/Core/SourceManager.h" Modified: lldb/trunk/source/Commands/CommandObjectTranslate.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTranslate.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTranslate.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTranslate.cpp Tue Jun 15 14:49:27 2010 @@ -13,8 +13,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Args.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" Modified: lldb/trunk/source/Commands/CommandObjectVariable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectVariable.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectVariable.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectVariable.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Core/Module.h" #include "lldb/Core/StreamFile.h" #include "lldb/Core/Value.h" Removed: lldb/trunk/source/Core/Args.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Args.cpp?rev=106033&view=auto ============================================================================== --- lldb/trunk/source/Core/Args.cpp (original) +++ lldb/trunk/source/Core/Args.cpp (removed) @@ -1,1103 +0,0 @@ -//===-- Args.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// C Includes -#include -#include -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Args.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/Options.h" -#include "lldb/Interpreter/CommandReturnObject.h" - -using namespace lldb; -using namespace lldb_private; - -static const char *k_space_characters = "\t\n\v\f\r "; -static const char *k_space_characters_with_slash = "\t\n\v\f\r \\"; - - -//---------------------------------------------------------------------- -// Args constructor -//---------------------------------------------------------------------- -Args::Args (const char *command) : - m_args(), - m_argv() -{ - SetCommandString (command); -} - - -Args::Args (const char *command, size_t len) : - m_args(), - m_argv() -{ - SetCommandString (command, len); -} - - - -//---------------------------------------------------------------------- -// Destructor -//---------------------------------------------------------------------- -Args::~Args () -{ -} - -void -Args::Dump (Stream *s) -{ -// int argc = GetArgumentCount(); -// -// arg_sstr_collection::const_iterator pos, begin = m_args.begin(), end = m_args.end(); -// for (pos = m_args.begin(); pos != end; ++pos) -// { -// s->Indent(); -// s->Printf("args[%zu]=%s\n", std::distance(begin, pos), pos->c_str()); -// } -// s->EOL(); - const int argc = m_argv.size(); - for (int i=0; iIndent(); - const char *arg_cstr = m_argv[i]; - if (arg_cstr) - s->Printf("argv[%i]=\"%s\"\n", i, arg_cstr); - else - s->Printf("argv[%i]=NULL\n", i); - } - s->EOL(); -} - -bool -Args::GetCommandString (std::string &command) -{ - command.clear(); - int argc = GetArgumentCount(); - for (int i=0; i 0) - command += ' '; - command += m_argv[i]; - } - return argc > 0; -} - -void -Args::SetCommandString (const char *command, size_t len) -{ - // Use std::string to make sure we get a NULL terminated string we can use - // as "command" could point to a string within a large string.... - std::string null_terminated_command(command, len); - SetCommandString(null_terminated_command.c_str()); -} - -void -Args::SetCommandString (const char *command) -{ - m_args.clear(); - m_argv.clear(); - if (command && command[0]) - { - const char *arg_start; - const char *next_arg_start; - for (arg_start = command, next_arg_start = NULL; - arg_start && arg_start[0]; - arg_start = next_arg_start, next_arg_start = NULL) - { - // Skip any leading space characters - arg_start = ::strspn (arg_start, k_space_characters) + arg_start; - - // If there were only space characters to the end of the line, then - // we're done. - if (*arg_start == '\0') - break; - - std::string arg; - const char *arg_end = NULL; - - switch (*arg_start) - { - case '\'': - case '"': - case '`': - { - // Look for either a quote character, or the backslash - // character - const char quote_char = *arg_start; - char find_chars[3] = { quote_char, '\\' , '\0'}; - bool is_backtick = (quote_char == '`'); - if (quote_char == '"' || quote_char == '`') - m_args_quote_char.push_back(quote_char); - else - m_args_quote_char.push_back('\0'); - - while (*arg_start != '\0') - { - arg_end = ::strcspn (arg_start + 1, find_chars) + arg_start + 1; - - if (*arg_end == '\0') - { - arg.append (arg_start); - break; - } - - // Watch out for quote characters prefixed with '\' - if (*arg_end == '\\') - { - if (arg_end[1] == quote_char) - { - // The character following the '\' is our quote - // character so strip the backslash character - arg.append (arg_start, arg_end); - } - else - { - // The character following the '\' is NOT our - // quote character, so include the backslash - // and continue - arg.append (arg_start, arg_end + 1); - } - arg_start = arg_end + 1; - continue; - } - else - { - arg.append (arg_start, arg_end + 1); - next_arg_start = arg_end + 1; - break; - } - } - - // Skip single and double quotes, but leave backtick quotes - if (!is_backtick) - { - char first_c = arg[0]; - arg.erase(0,1); - // Only erase the last character if it is the same as the first. - // Otherwise, we're parsing an incomplete command line, and we - // would be stripping off the last character of that string. - if (arg[arg.size() - 1] == first_c) - arg.erase(arg.size() - 1, 1); - } - } - break; - default: - { - m_args_quote_char.push_back('\0'); - // Look for the next non-escaped space character - while (*arg_start != '\0') - { - arg_end = ::strcspn (arg_start, k_space_characters_with_slash) + arg_start; - - if (arg_end == NULL) - { - arg.append(arg_start); - break; - } - - if (*arg_end == '\\') - { - // Append up to the '\' char - arg.append (arg_start, arg_end); - - if (arg_end[1] == '\0') - break; - - // Append the character following the '\' if it isn't - // the end of the string - arg.append (1, arg_end[1]); - arg_start = arg_end + 2; - continue; - } - else - { - arg.append (arg_start, arg_end); - next_arg_start = arg_end; - break; - } - } - } - break; - } - - m_args.push_back(arg); - } - } - UpdateArgvFromArgs(); -} - -void -Args::UpdateArgsAfterOptionParsing() -{ - // Now m_argv might be out of date with m_args, so we need to fix that - arg_cstr_collection::const_iterator argv_pos, argv_end = m_argv.end(); - arg_sstr_collection::iterator args_pos; - arg_quote_char_collection::iterator quotes_pos; - - for (argv_pos = m_argv.begin(), args_pos = m_args.begin(), quotes_pos = m_args_quote_char.begin(); - argv_pos != argv_end && args_pos != m_args.end(); - ++argv_pos) - { - const char *argv_cstr = *argv_pos; - if (argv_cstr == NULL) - break; - - while (args_pos != m_args.end()) - { - const char *args_cstr = args_pos->c_str(); - if (args_cstr == argv_cstr) - { - // We found the argument that matches the C string in the - // vector, so we can now look for the next one - ++args_pos; - ++quotes_pos; - break; - } - else - { - quotes_pos = m_args_quote_char.erase (quotes_pos); - args_pos = m_args.erase (args_pos); - } - } - } - - if (args_pos != m_args.end()) - m_args.erase (args_pos, m_args.end()); - - if (quotes_pos != m_args_quote_char.end()) - m_args_quote_char.erase (quotes_pos, m_args_quote_char.end()); -} - -void -Args::UpdateArgvFromArgs() -{ - m_argv.clear(); - arg_sstr_collection::const_iterator pos, end = m_args.end(); - for (pos = m_args.begin(); pos != end; ++pos) - m_argv.push_back(pos->c_str()); - m_argv.push_back(NULL); -} - -size_t -Args::GetArgumentCount() const -{ - if (m_argv.empty()) - return 0; - return m_argv.size() - 1; -} - -const char * -Args::GetArgumentAtIndex (size_t idx) const -{ - if (idx < m_argv.size()) - return m_argv[idx]; - return NULL; -} - -char -Args::GetArgumentQuoteCharAtIndex (size_t idx) const -{ - if (idx < m_args_quote_char.size()) - return m_args_quote_char[idx]; - return '\0'; -} - -char ** -Args::GetArgumentVector() -{ - if (!m_argv.empty()) - return (char **)&m_argv[0]; - return NULL; -} - -const char ** -Args::GetConstArgumentVector() const -{ - if (!m_argv.empty()) - return (const char **)&m_argv[0]; - return NULL; -} - -void -Args::Shift () -{ - // Don't pop the last NULL terminator from the argv array - if (m_argv.size() > 1) - { - m_argv.erase(m_argv.begin()); - m_args.pop_front(); - m_args_quote_char.erase(m_args_quote_char.begin()); - } -} - -const char * -Args::Unshift (const char *arg_cstr, char quote_char) -{ - m_args.push_front(arg_cstr); - m_argv.insert(m_argv.begin(), m_args.front().c_str()); - m_args_quote_char.insert(m_args_quote_char.begin(), quote_char); - return GetArgumentAtIndex (0); -} - -void -Args::AppendArguments (const Args &rhs) -{ - const size_t rhs_argc = rhs.GetArgumentCount(); - for (size_t i=0; i 0 && pos != end; ++pos) - --i; - - pos = m_args.insert(pos, arg_cstr); - - - m_args_quote_char.insert(m_args_quote_char.begin() + idx, quote_char); - - UpdateArgvFromArgs(); - return GetArgumentAtIndex(idx); -} - -const char * -Args::ReplaceArgumentAtIndex (size_t idx, const char *arg_cstr, char quote_char) -{ - // Since we are using a std::list to hold onto the copied C string and - // we don't have direct access to the elements, we have to iterate to - // find the value. - arg_sstr_collection::iterator pos, end = m_args.end(); - size_t i = idx; - for (pos = m_args.begin(); i > 0 && pos != end; ++pos) - --i; - - if (pos != end) - { - pos->assign(arg_cstr); - assert(idx < m_argv.size() - 1); - m_argv[idx] = pos->c_str(); - m_args_quote_char[idx] = quote_char; - return GetArgumentAtIndex(idx); - } - return NULL; -} - -void -Args::DeleteArgumentAtIndex (size_t idx) -{ - // Since we are using a std::list to hold onto the copied C string and - // we don't have direct access to the elements, we have to iterate to - // find the value. - arg_sstr_collection::iterator pos, end = m_args.end(); - size_t i = idx; - for (pos = m_args.begin(); i > 0 && pos != end; ++pos) - --i; - - if (pos != end) - { - m_args.erase (pos); - assert(idx < m_argv.size() - 1); - m_argv.erase(m_argv.begin() + idx); - m_args_quote_char.erase(m_args_quote_char.begin() + idx); - } -} - -void -Args::SetArguments (int argc, const char **argv) -{ - // m_argv will be rebuilt in UpdateArgvFromArgs() below, so there is - // no need to clear it here. - m_args.clear(); - m_args_quote_char.clear(); - - // Make a copy of the arguments in our internal buffer - size_t i; - // First copy each string - for (i=0; iOptionSeen (val); - - // Lookup the long option index - if (long_options_index == -1) - { - for (int i=0; - long_options[i].name || long_options[i].has_arg || long_options[i].flag || long_options[i].val; - ++i) - { - if (long_options[i].val == val) - { - long_options_index = i; - break; - } - } - } - // Call the callback with the option - if (long_options_index >= 0) - { - error = options.SetOptionValue(long_options_index, - long_options[long_options_index].has_arg == no_argument ? NULL : optarg); - } - else - { - error.SetErrorStringWithFormat("Invalid option with value '%i'.\n", val); - } - if (error.Fail()) - break; - } - - // Update our ARGV now that get options has consumed all the options - m_argv.erase(m_argv.begin(), m_argv.begin() + optind); - UpdateArgsAfterOptionParsing (); - return error; -} - -void -Args::Clear () -{ - m_args.clear (); - m_argv.clear (); - m_args_quote_char.clear(); -} - -int32_t -Args::StringToSInt32 (const char *s, int32_t fail_value, int base, bool *success_ptr) -{ - if (s && s[0]) - { - char *end = NULL; - int32_t uval = ::strtol (s, &end, base); - if (*end == '\0') - { - if (success_ptr) *success_ptr = true; - return uval; // All characters were used, return the result - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - -uint32_t -Args::StringToUInt32 (const char *s, uint32_t fail_value, int base, bool *success_ptr) -{ - if (s && s[0]) - { - char *end = NULL; - uint32_t uval = ::strtoul (s, &end, base); - if (*end == '\0') - { - if (success_ptr) *success_ptr = true; - return uval; // All characters were used, return the result - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - - -int64_t -Args::StringToSInt64 (const char *s, int64_t fail_value, int base, bool *success_ptr) -{ - if (s && s[0]) - { - char *end = NULL; - int64_t uval = ::strtoll (s, &end, base); - if (*end == '\0') - { - if (success_ptr) *success_ptr = true; - return uval; // All characters were used, return the result - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - -uint64_t -Args::StringToUInt64 (const char *s, uint64_t fail_value, int base, bool *success_ptr) -{ - if (s && s[0]) - { - char *end = NULL; - uint64_t uval = ::strtoull (s, &end, base); - if (*end == '\0') - { - if (success_ptr) *success_ptr = true; - return uval; // All characters were used, return the result - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - -lldb::addr_t -Args::StringToAddress (const char *s, lldb::addr_t fail_value, bool *success_ptr) -{ - if (s && s[0]) - { - char *end = NULL; - lldb::addr_t addr = ::strtoull (s, &end, 0); - if (*end == '\0') - { - if (success_ptr) *success_ptr = true; - return addr; // All characters were used, return the result - } - // Try base 16 with no prefix... - addr = ::strtoull (s, &end, 16); - if (*end == '\0') - { - if (success_ptr) *success_ptr = true; - return addr; // All characters were used, return the result - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - -bool -Args::StringToBoolean (const char *s, bool fail_value, bool *success_ptr) -{ - if (s && s[0]) - { - if (::strcasecmp (s, "false") == 0 || - ::strcasecmp (s, "off") == 0 || - ::strcasecmp (s, "no") == 0 || - ::strcmp (s, "0") == 0) - { - if (success_ptr) - *success_ptr = true; - return false; - } - else - if (::strcasecmp (s, "true") == 0 || - ::strcasecmp (s, "on") == 0 || - ::strcasecmp (s, "yes") == 0 || - ::strcmp (s, "1") == 0) - { - if (success_ptr) *success_ptr = true; - return true; - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - -int32_t -Args::StringToOptionEnum (const char *s, lldb::OptionEnumValueElement *enum_values, int32_t fail_value, bool *success_ptr) -{ - if (enum_values && s && s[0]) - { - for (int i = 0; enum_values[i].string_value != NULL ; i++) - { - if (strstr(enum_values[i].string_value, s) == enum_values[i].string_value) - { - if (success_ptr) *success_ptr = true; - return enum_values[i].value; - } - } - } - if (success_ptr) *success_ptr = false; - - return fail_value; -} - -ScriptLanguage -Args::StringToScriptLanguage (const char *s, ScriptLanguage fail_value, bool *success_ptr) -{ - if (s && s[0]) - { - if ((::strcasecmp (s, "python") == 0) || - (::strcasecmp (s, "default") == 0 && eScriptLanguagePython == eScriptLanguageDefault)) - { - if (success_ptr) *success_ptr = true; - return eScriptLanguagePython; - } - if (::strcasecmp (s, "none")) - { - if (success_ptr) *success_ptr = true; - return eScriptLanguageNone; - } - } - if (success_ptr) *success_ptr = false; - return fail_value; -} - -Error -Args::StringToFormat -( - const char *s, - lldb::Format &format -) -{ - format = eFormatInvalid; - Error error; - - if (s && s[0]) - { - switch (s[0]) - { - case 'y': format = eFormatBytes; break; - case 'Y': format = eFormatBytesWithASCII; break; - case 'b': format = eFormatBinary; break; - case 'B': format = eFormatBoolean; break; - case 'c': format = eFormatChar; break; - case 'C': format = eFormatCharPrintable; break; - case 'o': format = eFormatOctal; break; - case 'i': - case 'd': format = eFormatDecimal; break; - case 'u': format = eFormatUnsigned; break; - case 'x': format = eFormatHex; break; - case 'f': - case 'e': - case 'g': format = eFormatFloat; break; - case 'p': format = eFormatPointer; break; - case 's': format = eFormatCString; break; - default: - error.SetErrorStringWithFormat("Invalid format character '%c'. Valid values are:\n" - " b - binary\n" - " B - boolean\n" - " c - char\n" - " C - printable char\n" - " d - signed decimal\n" - " e - float\n" - " f - float\n" - " g - float\n" - " i - signed decimal\n" - " o - octal\n" - " s - c-string\n" - " u - unsigned decimal\n" - " x - hex\n" - " y - bytes\n" - " Y - bytes with ASCII\n", s[0]); - break; - } - - if (error.Fail()) - return error; - } - else - { - error.SetErrorStringWithFormat("%s option string.\n", s ? "empty" : "invalid"); - } - return error; -} - -void -Args::LongestCommonPrefix (std::string &common_prefix) -{ - arg_sstr_collection::iterator pos, end = m_args.end(); - pos = m_args.begin(); - if (pos == end) - common_prefix.clear(); - else - common_prefix = (*pos); - - for (++pos; pos != end; ++pos) - { - int new_size = (*pos).size(); - - // First trim common_prefix if it is longer than the current element: - if (common_prefix.size() > new_size) - common_prefix.erase (new_size); - - // Then trim it at the first disparity: - - for (int i = 0; i < common_prefix.size(); i++) - { - if ((*pos)[i] != common_prefix[i]) - { - common_prefix.erase(i); - break; - } - } - - // If we've emptied the common prefix, we're done. - if (common_prefix.empty()) - break; - } -} - -void -Args::ParseAliasOptions -( - Options &options, - CommandReturnObject &result, - OptionArgVector *option_arg_vector -) -{ - StreamString sstr; - int i; - struct option *long_options = options.GetLongOptions(); - - if (long_options == NULL) - { - result.AppendError ("invalid long options"); - result.SetStatus (eReturnStatusFailed); - return; - } - - for (i = 0; long_options[i].name != NULL; ++i) - { - if (long_options[i].flag == NULL) - { - sstr << (char) long_options[i].val; - switch (long_options[i].has_arg) - { - default: - case no_argument: - break; - case required_argument: - sstr << ":"; - break; - case optional_argument: - sstr << "::"; - break; - } - } - } - -#ifdef __GLIBC__ - optind = 0; -#else - optreset = 1; - optind = 1; -#endif - int val; - while (1) - { - int long_options_index = -1; - val = ::getopt_long (GetArgumentCount(), GetArgumentVector(), sstr.GetData(), long_options, - &long_options_index); - - if (val == -1) - break; - - if (val == '?') - { - result.AppendError ("unknown or ambiguous option"); - result.SetStatus (eReturnStatusFailed); - break; - } - - if (val == 0) - continue; - - ((Options *) &options)->OptionSeen (val); - - // Look up the long option index - if (long_options_index == -1) - { - for (int j = 0; - long_options[j].name || long_options[j].has_arg || long_options[j].flag || long_options[j].val; - ++j) - { - if (long_options[j].val == val) - { - long_options_index = j; - break; - } - } - } - - // See if the option takes an argument, and see if one was supplied. - if (long_options_index >= 0) - { - StreamString option_str; - option_str.Printf ("-%c", (char) val); - - switch (long_options[long_options_index].has_arg) - { - case no_argument: - option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), "")); - break; - case required_argument: - if (optarg != NULL) - { - option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - std::string (optarg))); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - else - { - result.AppendErrorWithFormat ("Option '%s' is missing argument specifier.\n", - option_str.GetData()); - result.SetStatus (eReturnStatusFailed); - } - break; - case optional_argument: - if (optarg != NULL) - { - option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - std::string (optarg))); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - else - { - option_arg_vector->push_back (OptionArgPair (std::string (option_str.GetData()), - "")); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - break; - default: - result.AppendErrorWithFormat - ("error with options table; invalid value in has_arg field for option '%c'.\n", - (char) val); - result.SetStatus (eReturnStatusFailed); - break; - } - } - else - { - result.AppendErrorWithFormat ("Invalid option with value '%c'.\n", (char) val); - result.SetStatus (eReturnStatusFailed); - } - if (!result.Succeeded()) - break; - } -} - -void -Args::ParseArgsForCompletion -( - Options &options, - OptionElementVector &option_element_vector -) -{ - StreamString sstr; - int i; - struct option *long_options = options.GetLongOptions(); - option_element_vector.clear(); - - if (long_options == NULL) - { - return; - } - - // Leading : tells getopt to return a : for a missing option argument AND - // to suppress error messages. - - sstr << ":"; - for (i = 0; long_options[i].name != NULL; ++i) - { - if (long_options[i].flag == NULL) - { - sstr << (char) long_options[i].val; - switch (long_options[i].has_arg) - { - default: - case no_argument: - break; - case required_argument: - sstr << ":"; - break; - case optional_argument: - sstr << "::"; - break; - } - } - } - -#ifdef __GLIBC__ - optind = 0; -#else - optreset = 1; - optind = 1; -#endif - opterr = 0; - - int val; - const OptionDefinition *opt_defs = options.GetDefinitions(); - - // Fooey... getopt_long permutes the GetArgumentVector for no apparent reason. - // So we have to build another Arg and pass that to getopt_long so it doesn't - // screw up the one we have. - - std::vector dummy_vec(GetArgumentVector(), GetArgumentVector() + GetArgumentCount() + 1); - - while (1) - { - bool missing_argument = false; - int parse_start = optind; - int long_options_index = -1; - val = ::getopt_long (dummy_vec.size() - 1,(char *const *) dummy_vec.data(), sstr.GetData(), long_options, - &long_options_index); - - if (val == -1) - break; - - else if (val == '?') - { - option_element_vector.push_back (OptionArgElement (-1, parse_start, -1)); - continue; - } - else if (val == 0) - { - continue; - } - else if (val == ':') - { - // This is a missing argument. - val = optopt; - missing_argument = true; - } - - ((Options *) &options)->OptionSeen (val); - - // Look up the long option index - if (long_options_index == -1) - { - for (int j = 0; - long_options[j].name || long_options[j].has_arg || long_options[j].flag || long_options[j].val; - ++j) - { - if (long_options[j].val == val) - { - long_options_index = j; - break; - } - } - } - - // See if the option takes an argument, and see if one was supplied. - if (long_options_index >= 0) - { - int opt_defs_index = -1; - for (int i = 0; ; i++) - { - if (opt_defs[i].short_option == 0) - break; - else if (opt_defs[i].short_option == val) - { - opt_defs_index = i; - break; - } - } - - switch (long_options[long_options_index].has_arg) - { - case no_argument: - option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, 0)); - break; - case required_argument: - if (optarg != NULL) - { - int arg_index; - if (missing_argument) - arg_index = -1; - else - arg_index = parse_start + 1; - - option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, arg_index)); - } - else - { - option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, -1)); - } - break; - case optional_argument: - if (optarg != NULL) - { - option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, 0)); - } - else - { - option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, parse_start + 1)); - } - break; - default: - // The options table is messed up. Here we'll just continue - option_element_vector.push_back (OptionArgElement (-1, parse_start, -1)); - break; - } - } - else - { - option_element_vector.push_back (OptionArgElement (-1, parse_start, -1)); - } - } -} Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original) +++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Tue Jun 15 14:49:27 2010 @@ -25,7 +25,7 @@ // Other libraries and framework includes // Project includes #include "lldb/lldb-private-log.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Communication.h" #include "lldb/Core/Log.h" #include "lldb/Core/RegularExpression.h" Removed: lldb/trunk/source/Core/Options.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Options.cpp?rev=106033&view=auto ============================================================================== --- lldb/trunk/source/Core/Options.cpp (original) +++ lldb/trunk/source/Core/Options.cpp (removed) @@ -1,734 +0,0 @@ -//===-- Options.cpp ---------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Core/Options.h" - -// C Includes -// C++ Includes -#include - -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObject.h" -#include "lldb/Interpreter/CommandReturnObject.h" -#include "lldb/Interpreter/CommandCompletions.h" -#include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Target/Target.h" - -using namespace lldb; -using namespace lldb_private; - -//------------------------------------------------------------------------- -// Options -//------------------------------------------------------------------------- -Options::Options () : - m_getopt_table () -{ - BuildValidOptionSets(); -} - -Options::~Options () -{ -} - - -void -Options::ResetOptionValues () -{ - m_seen_options.clear(); -} - -void -Options::OptionSeen (int option_idx) -{ - m_seen_options.insert ((char) option_idx); -} - -// Returns true is set_a is a subset of set_b; Otherwise returns false. - -bool -Options::IsASubset (const OptionSet& set_a, const OptionSet& set_b) -{ - bool is_a_subset = true; - OptionSet::const_iterator pos_a; - OptionSet::const_iterator pos_b; - - // set_a is a subset of set_b if every member of set_a is also a member of set_b - - for (pos_a = set_a.begin(); pos_a != set_a.end() && is_a_subset; ++pos_a) - { - pos_b = set_b.find(*pos_a); - if (pos_b == set_b.end()) - is_a_subset = false; - } - - return is_a_subset; -} - -// Returns the set difference set_a - set_b, i.e. { x | ElementOf (x, set_a) && !ElementOf (x, set_b) } - -size_t -Options::OptionsSetDiff (const OptionSet& set_a, const OptionSet& set_b, OptionSet& diffs) -{ - size_t num_diffs = 0; - OptionSet::const_iterator pos_a; - OptionSet::const_iterator pos_b; - - for (pos_a = set_a.begin(); pos_a != set_a.end(); ++pos_a) - { - pos_b = set_b.find(*pos_a); - if (pos_b == set_b.end()) - { - ++num_diffs; - diffs.insert(*pos_a); - } - } - - return num_diffs; -} - -// Returns the union of set_a and set_b. Does not put duplicate members into the union. - -void -Options::OptionsSetUnion (const OptionSet &set_a, const OptionSet &set_b, OptionSet &union_set) -{ - OptionSet::const_iterator pos; - OptionSet::iterator pos_union; - - // Put all the elements of set_a into the union. - - for (pos = set_a.begin(); pos != set_a.end(); ++pos) - union_set.insert(*pos); - - // Put all the elements of set_b that are not already there into the union. - for (pos = set_b.begin(); pos != set_b.end(); ++pos) - { - pos_union = union_set.find(*pos); - if (pos_union == union_set.end()) - union_set.insert(*pos); - } -} - -bool -Options::VerifyOptions (CommandReturnObject &result) -{ - bool options_are_valid = false; - - int num_levels = m_required_options.size(); - if (num_levels) - { - for (int i = 0; i < num_levels && !options_are_valid; ++i) - { - // This is the correct set of options if: 1). m_seen_options contains all of m_required_options[i] - // (i.e. all the required options at this level are a subset of m_seen_options); AND - // 2). { m_seen_options - m_required_options[i] is a subset of m_options_options[i] (i.e. all the rest of - // m_seen_options are in the set of optional options at this level. - - // Check to see if all of m_required_options[i] are a subset of m_seen_options - if (IsASubset (m_required_options[i], m_seen_options)) - { - // Construct the set difference: remaining_options = {m_seen_options} - {m_required_options[i]} - OptionSet remaining_options; - OptionsSetDiff (m_seen_options, m_required_options[i], remaining_options); - // Check to see if remaining_options is a subset of m_optional_options[i] - if (IsASubset (remaining_options, m_optional_options[i])) - options_are_valid = true; - } - } - } - else - { - options_are_valid = true; - } - - if (options_are_valid) - { - result.SetStatus (eReturnStatusSuccessFinishNoResult); - } - else - { - result.AppendError ("invalid combination of options for the given command"); - result.SetStatus (eReturnStatusFailed); - } - - return options_are_valid; -} - -// This is called in the Options constructor, though we could call it lazily if that ends up being -// a performance problem. - -void -Options::BuildValidOptionSets () -{ - // Check to see if we already did this. - if (m_required_options.size() != 0) - return; - - // Check to see if there are any options. - int num_options = NumCommandOptions (); - if (num_options == 0) - return; - - const lldb::OptionDefinition *full_options_table = GetDefinitions(); - m_required_options.resize(1); - m_optional_options.resize(1); - - // First count the number of option sets we've got. Ignore LLDB_ALL_OPTION_SETS... - - uint32_t num_option_sets = 0; - - for (int i = 0; i < num_options; i++) - { - uint32_t this_usage_mask = full_options_table[i].usage_mask; - if (this_usage_mask == LLDB_OPT_SET_ALL) - { - if (num_option_sets == 0) - num_option_sets = 1; - } - else - { - for (int j = 0; j < LLDB_MAX_NUM_OPTION_SETS; j++) - { - if (this_usage_mask & 1 << j) - { - if (num_option_sets <= j) - num_option_sets = j + 1; - } - } - } - } - - if (num_option_sets > 0) - { - m_required_options.resize(num_option_sets); - m_optional_options.resize(num_option_sets); - - for (int i = 0; i < num_options; ++i) - { - for (int j = 0; j < num_option_sets; j++) - { - if (full_options_table[i].usage_mask & 1 << j) - { - if (full_options_table[i].required) - m_required_options[j].insert(full_options_table[i].short_option); - else - m_optional_options[j].insert(full_options_table[i].short_option); - } - } - } - } -} - -uint32_t -Options::NumCommandOptions () -{ - const lldb::OptionDefinition *full_options_table = GetDefinitions (); - if (full_options_table == NULL) - return 0; - - int i = 0; - - if (full_options_table != NULL) - { - while (full_options_table[i].long_option != NULL) - ++i; - } - - return i; -} - -struct option * -Options::GetLongOptions () -{ - // Check to see if this has already been done. - if (m_getopt_table.empty()) - { - // Check to see if there are any options. - const uint32_t num_options = NumCommandOptions(); - if (num_options == 0) - return NULL; - - uint32_t i; - uint32_t j; - const lldb::OptionDefinition *full_options_table = GetDefinitions(); - - std::bitset<256> option_seen; - - m_getopt_table.resize(num_options + 1); - for (i = 0, j = 0; i < num_options; ++i) - { - char short_opt = full_options_table[i].short_option; - - if (option_seen.test(short_opt) == false) - { - m_getopt_table[j].name = full_options_table[i].long_option; - m_getopt_table[j].has_arg = full_options_table[i].option_has_arg; - m_getopt_table[j].flag = NULL; - m_getopt_table[j].val = full_options_table[i].short_option; - option_seen.set(short_opt); - ++j; - } - } - - //getopt_long requires a NULL final entry in the table: - - m_getopt_table[j].name = NULL; - m_getopt_table[j].has_arg = 0; - m_getopt_table[j].flag = NULL; - m_getopt_table[j].val = 0; - } - - return m_getopt_table.data(); -} - - -// This function takes INDENT, which tells how many spaces to output at the front of each line; SPACES, which is -// a string containing 80 spaces; and TEXT, which is the text that is to be output. It outputs the text, on -// multiple lines if necessary, to RESULT, with INDENT spaces at the front of each line. It breaks lines on spaces, -// tabs or newlines, shortening the line if necessary to not break in the middle of a word. It assumes that each -// output line should contain a maximum of OUTPUT_MAX_COLUMNS characters. - - -void -Options::OutputFormattedUsageText -( - Stream &strm, - const char *text, - uint32_t output_max_columns -) -{ - int len = strlen (text); - - // Will it all fit on one line? - - if ((len + strm.GetIndentLevel()) < output_max_columns) - { - // Output it as a single line. - strm.Indent (text); - strm.EOL(); - } - else - { - // We need to break it up into multiple lines. - - int text_width = output_max_columns - strm.GetIndentLevel() - 1; - int start = 0; - int end = start; - int final_end = strlen (text); - int sub_len; - - while (end < final_end) - { - // Don't start the 'text' on a space, since we're already outputting the indentation. - while ((start < final_end) && (text[start] == ' ')) - start++; - - end = start + text_width; - if (end > final_end) - end = final_end; - else - { - // If we're not at the end of the text, make sure we break the line on white space. - while (end > start - && text[end] != ' ' && text[end] != '\t' && text[end] != '\n') - end--; - } - - sub_len = end - start; - if (start != 0) - strm.EOL(); - strm.Indent(); - assert (start < final_end); - assert (start + sub_len <= final_end); - strm.Write(text + start, sub_len); - start = end + 1; - } - strm.EOL(); - } -} - -void -Options::GenerateOptionUsage -( - Stream &strm, - CommandObject *cmd, - const char *program_name) -{ - uint32_t screen_width = 80; - const lldb::OptionDefinition *full_options_table = GetDefinitions(); - const uint32_t save_indent_level = strm.GetIndentLevel(); - const char *name; - - if (cmd) - name = cmd->GetCommandName(); - else - name = program_name; - - strm.PutCString ("\nCommand Options Usage:\n"); - - strm.IndentMore(2); - - // First, show each usage level set of options, e.g. [options-for-level-0] - // [options-for-level-1] - // etc. - - const uint32_t num_options = NumCommandOptions(); - if (num_options == 0) - return; - - BuildValidOptionSets (); - int num_option_sets = m_required_options.size(); - - uint32_t i; - - for (uint32_t opt_set = 0; opt_set < num_option_sets; ++opt_set) - { - uint32_t opt_set_mask; - - opt_set_mask = 1 << opt_set; - if (opt_set > 0) - strm.Printf ("\n"); - strm.Indent (name); - - for (i = 0; i < num_options; ++i) - { - if (full_options_table[i].usage_mask & opt_set_mask) - { - // Add current option to the end of out_stream. - - if (full_options_table[i].required) - { - if (full_options_table[i].option_has_arg == required_argument) - { - strm.Printf (" -%c %s", - full_options_table[i].short_option, - full_options_table[i].argument_name); - } - else if (full_options_table[i].option_has_arg == optional_argument) - { - strm.Printf (" -%c [%s]", - full_options_table[i].short_option, - full_options_table[i].argument_name); - } - else - strm.Printf (" -%c", full_options_table[i].short_option); - } - else - { - if (full_options_table[i].option_has_arg == required_argument) - strm.Printf (" [-%c %s]", full_options_table[i].short_option, - full_options_table[i].argument_name); - else if (full_options_table[i].option_has_arg == optional_argument) - strm.Printf (" [-%c [%s]]", full_options_table[i].short_option, - full_options_table[i].argument_name); - else - strm.Printf (" [-%c]", full_options_table[i].short_option); - } - } - } - } - strm.Printf ("\n\n"); - - // Now print out all the detailed information about the various options: long form, short form and help text: - // -- long_name - // - short - // help text - - // This variable is used to keep track of which options' info we've printed out, because some options can be in - // more than one usage level, but we only want to print the long form of its information once. - - OptionSet options_seen; - OptionSet::iterator pos; - strm.IndentMore (5); - - int first_option_printed = 1; - for (i = 0; i < num_options; ++i) - { - // Only print out this option if we haven't already seen it. - pos = options_seen.find (full_options_table[i].short_option); - if (pos == options_seen.end()) - { - // Put a newline separation between arguments - if (first_option_printed) - first_option_printed = 0; - else - strm.EOL(); - - options_seen.insert (full_options_table[i].short_option); - strm.Indent (); - strm.Printf ("-%c ", full_options_table[i].short_option); - if (full_options_table[i].argument_name != NULL) - strm.PutCString(full_options_table[i].argument_name); - strm.EOL(); - strm.Indent (); - strm.Printf ("--%s ", full_options_table[i].long_option); - if (full_options_table[i].argument_name != NULL) - strm.PutCString(full_options_table[i].argument_name); - strm.EOL(); - - strm.IndentMore (5); - - if (full_options_table[i].usage_text) - OutputFormattedUsageText (strm, - full_options_table[i].usage_text, - screen_width); - if (full_options_table[i].enum_values != NULL) - { - strm.Indent (); - strm.Printf("Values: "); - for (int j = 0; full_options_table[i].enum_values[j].string_value != NULL; j++) - { - if (j == 0) - strm.Printf("%s", full_options_table[i].enum_values[j].string_value); - else - strm.Printf(" | %s", full_options_table[i].enum_values[j].string_value); - } - strm.EOL(); - } - strm.IndentLess (5); - } - } - - // Restore the indent level - strm.SetIndentLevel (save_indent_level); -} - -// This function is called when we have been given a potentially incomplete set of -// options, such as when an alias has been defined (more options might be added at -// at the time the alias is invoked). We need to verify that the options in the set -// m_seen_options are all part of a set that may be used together, but m_seen_options -// may be missing some of the "required" options. - -bool -Options::VerifyPartialOptions (CommandReturnObject &result) -{ - bool options_are_valid = false; - - int num_levels = m_required_options.size(); - if (num_levels) - { - for (int i = 0; i < num_levels && !options_are_valid; ++i) - { - // In this case we are treating all options as optional rather than required. - // Therefore a set of options is correct if m_seen_options is a subset of the - // union of m_required_options and m_optional_options. - OptionSet union_set; - OptionsSetUnion (m_required_options[i], m_optional_options[i], union_set); - if (IsASubset (m_seen_options, union_set)) - options_are_valid = true; - } - } - - return options_are_valid; -} - -bool -Options::HandleOptionCompletion -( - Args &input, - OptionElementVector &opt_element_vector, - int cursor_index, - int char_pos, - int match_start_point, - int max_return_elements, - lldb_private::CommandInterpreter *interpreter, - lldb_private::StringList &matches -) -{ - // For now we just scan the completions to see if the cursor position is in - // an option or its argument. Otherwise we'll call HandleArgumentCompletion. - // In the future we can use completion to validate options as well if we want. - - const OptionDefinition *opt_defs = GetDefinitions(); - - std::string cur_opt_std_str (input.GetArgumentAtIndex(cursor_index)); - cur_opt_std_str.erase(char_pos); - const char *cur_opt_str = cur_opt_std_str.c_str(); - - for (int i = 0; i < opt_element_vector.size(); i++) - { - int opt_pos = opt_element_vector[i].opt_pos; - int opt_arg_pos = opt_element_vector[i].opt_arg_pos; - int opt_defs_index = opt_element_vector[i].opt_defs_index; - if (opt_pos == cursor_index) - { - // We're completing the option itself. - if (opt_defs_index != -1) - { - // We recognized it, if it an incomplete long option, complete it anyway (getopt_long is - // happy with shortest unique string, but it's still a nice thing to do.) Otherwise return - // The string so the upper level code will know this is a full match and add the " ". - if (cur_opt_str && strlen (cur_opt_str) > 2 - && cur_opt_str[0] == '-' && cur_opt_str[1] == '-' - && strcmp (opt_defs[opt_defs_index].long_option, cur_opt_str) != 0) - { - std::string full_name ("--"); - full_name.append (opt_defs[opt_defs_index].long_option); - matches.AppendString(full_name.c_str()); - return true; - } - else - { - matches.AppendString(input.GetArgumentAtIndex(cursor_index)); - return true; - } - } - else - { - // FIXME - not handling wrong options yet: - // Check to see if they are writing a long option & complete it. - // I think we will only get in here if the long option table has two elements - // that are not unique up to this point. getopt_long does shortest unique match - // for long options already. - - if (cur_opt_str && strlen (cur_opt_str) > 2 - && cur_opt_str[0] == '-' && cur_opt_str[1] == '-') - { - for (int i = 0 ; opt_defs[i].short_option != 0 ; i++) - { - if (strstr(opt_defs[i].long_option, cur_opt_str + 2) == opt_defs[i].long_option) - { - std::string full_name ("--"); - full_name.append (opt_defs[i].long_option); - // The options definitions table has duplicates because of the - // way the grouping information is stored, so only add once. - bool duplicate = false; - for (int j = 0; j < matches.GetSize(); j++) - { - if (matches.GetStringAtIndex(j) == full_name) - { - duplicate = true; - break; - } - } - if (!duplicate) - matches.AppendString(full_name.c_str()); - } - } - } - return true; - } - - - } - else if (opt_arg_pos == cursor_index) - { - // Okay the cursor is on the completion of an argument. - // See if it has a completion, otherwise return no matches. - - if (opt_defs_index != -1) - { - HandleOptionArgumentCompletion (input, - cursor_index, - strlen (input.GetArgumentAtIndex(cursor_index)), - opt_element_vector, - i, - match_start_point, - max_return_elements, - interpreter, - matches); - return true; - } - else - { - // No completion callback means no completions... - return true; - } - - } - else - { - // Not the last element, keep going. - continue; - } - } - return false; -} - -bool -Options::HandleOptionArgumentCompletion -( - Args &input, - int cursor_index, - int char_pos, - OptionElementVector &opt_element_vector, - int opt_element_index, - int match_start_point, - int max_return_elements, - lldb_private::CommandInterpreter *interpreter, - lldb_private::StringList &matches -) -{ - const OptionDefinition *opt_defs = GetDefinitions(); - std::auto_ptr filter_ap; - - int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos; - int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index; - - // See if this is an enumeration type option, and if so complete it here: - - OptionEnumValueElement *enum_values = opt_defs[opt_defs_index].enum_values; - if (enum_values != NULL) - { - bool return_value = false; - std::string match_string(input.GetArgumentAtIndex (opt_arg_pos), input.GetArgumentAtIndex (opt_arg_pos) + char_pos); - for (int i = 0; enum_values[i].string_value != NULL; i++) - { - if (strstr(enum_values[i].string_value, match_string.c_str()) == enum_values[i].string_value) - { - matches.AppendString (enum_values[i].string_value); - return_value = true; - } - } - return return_value; - } - - // If this is a source file or symbol type completion, and there is a - // -shlib option somewhere in the supplied arguments, then make a search filter - // for that shared library. - // FIXME: Do we want to also have an "OptionType" so we don't have to match string names? - - uint32_t completion_mask = opt_defs[opt_defs_index].completionType; - if (completion_mask & CommandCompletions::eSourceFileCompletion - || completion_mask & CommandCompletions::eSymbolCompletion) - { - for (int i = 0; i < opt_element_vector.size(); i++) - { - int cur_defs_index = opt_element_vector[i].opt_defs_index; - int cur_arg_pos = opt_element_vector[i].opt_arg_pos; - const char *cur_opt_name = opt_defs[cur_defs_index].long_option; - - // If this is the "shlib" option and there was an argument provided, - // restrict it to that shared library. - if (strcmp(cur_opt_name, "shlib") == 0 && cur_arg_pos != -1) - { - const char *module_name = input.GetArgumentAtIndex(cur_arg_pos); - if (module_name) - { - FileSpec module_spec(module_name); - lldb::TargetSP target_sp = interpreter->Context()->GetTarget()->GetSP(); - // Search filters require a target... - if (target_sp != NULL) - filter_ap.reset (new SearchFilterByModule (target_sp, module_spec)); - } - break; - } - } - } - - return CommandCompletions::InvokeCommonCompletionCallbacks (completion_mask, - input.GetArgumentAtIndex (opt_arg_pos), - match_start_point, - max_return_elements, - interpreter, - filter_ap.get(), - matches); - -} Modified: lldb/trunk/source/Core/Scalar.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Scalar.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Core/Scalar.cpp (original) +++ lldb/trunk/source/Core/Scalar.cpp Tue Jun 15 14:49:27 2010 @@ -11,7 +11,7 @@ #include -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Error.h" #include "lldb/Core/Stream.h" #include "lldb/Core/DataExtractor.h" Copied: lldb/trunk/source/Interpreter/Args.cpp (from r106033, lldb/trunk/source/Core/Args.cpp) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?p2=lldb/trunk/source/Interpreter/Args.cpp&p1=lldb/trunk/source/Core/Args.cpp&r1=106033&r2=106034&rev=106034&view=diff ============================================================================== --- lldb/trunk/source/Core/Args.cpp (original) +++ lldb/trunk/source/Interpreter/Args.cpp Tue Jun 15 14:49:27 2010 @@ -13,11 +13,11 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamString.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/CommandReturnObject.h" using namespace lldb; Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jun 15 14:49:27 2010 @@ -49,7 +49,7 @@ #include "../Commands/CommandObjectUnalias.h" #include "../Commands/CommandObjectVariable.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Stream.h" #include "lldb/Core/Timer.h" Modified: lldb/trunk/source/Interpreter/CommandObject.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue Jun 15 14:49:27 2010 @@ -17,7 +17,7 @@ #include #include "lldb/Core/Address.h" -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" // These are for the Sourcename completers. // FIXME: Make a separate file for the completers. Modified: lldb/trunk/source/Interpreter/CommandObjectScript.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObjectScript.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandObjectScript.cpp (original) +++ lldb/trunk/source/Interpreter/CommandObjectScript.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/ScriptInterpreter.h" Copied: lldb/trunk/source/Interpreter/Options.cpp (from r106033, lldb/trunk/source/Core/Options.cpp) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?p2=lldb/trunk/source/Interpreter/Options.cpp&p1=lldb/trunk/source/Core/Options.cpp&r1=106033&r2=106034&rev=106034&view=diff ============================================================================== --- lldb/trunk/source/Core/Options.cpp (original) +++ lldb/trunk/source/Interpreter/Options.cpp Tue Jun 15 14:49:27 2010 @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -#include "lldb/Core/Options.h" +#include "lldb/Interpreter/Options.h" // C Includes // C++ Includes Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp Tue Jun 15 14:49:27 2010 @@ -9,7 +9,7 @@ #include "ProcessMacOSXLog.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/StreamFile.h" #include "ProcessMacOSX.h" Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C Includes // C++ Includes // Other libraries and framework includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/ConnectionFileDescriptor.h" #include "lldb/Core/Log.h" #include "lldb/Core/State.h" Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jun 15 14:49:27 2010 @@ -26,7 +26,7 @@ // Other libraries and framework includes #include "lldb/Breakpoint/WatchpointLocation.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/ConnectionFileDescriptor.h" Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Tue Jun 15 14:49:27 2010 @@ -9,7 +9,7 @@ #include "ProcessGDBRemoteLog.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/StreamFile.h" #include "ProcessGDBRemote.h" Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Tue Jun 15 14:49:27 2010 @@ -9,7 +9,7 @@ #include "LogChannelDWARF.h" -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamFile.h" #include "SymbolFileDWARF.h" Modified: lldb/trunk/source/lldb-log.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=106034&r1=106033&r2=106034&view=diff ============================================================================== --- lldb/trunk/source/lldb-log.cpp (original) +++ lldb/trunk/source/lldb-log.cpp Tue Jun 15 14:49:27 2010 @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Args.h" +#include "lldb/Interpreter/Args.h" #include "lldb/Core/Log.h" #include "lldb/Core/StreamFile.h" #include From jmolenda at apple.com Tue Jun 15 15:04:41 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 15 Jun 2010 20:04:41 -0000 Subject: [Lldb-commits] [lldb] r106036 - /lldb/trunk/include/lldb/lldb-defines.h Message-ID: <20100615200441.8AC9F2A6C12C@llvm.org> Author: jmolenda Date: Tue Jun 15 15:04:41 2010 New Revision: 106036 URL: http://llvm.org/viewvc/llvm-project?rev=106036&view=rev Log: It makes me nervous seeing those bitfield shift values without parens. Modified: lldb/trunk/include/lldb/lldb-defines.h Modified: lldb/trunk/include/lldb/lldb-defines.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-defines.h?rev=106036&r1=106035&r2=106036&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-defines.h (original) +++ lldb/trunk/include/lldb/lldb-defines.h Tue Jun 15 15:04:41 2010 @@ -76,15 +76,15 @@ // FIXME: I'm sure there's some #define magic that can create all 32 sets on the // fly. That would have the added benefit of making this unreadable. #define LLDB_MAX_NUM_OPTION_SETS 32 -#define LLDB_OPT_SET_ALL 0xFFFFFFFF -#define LLDB_OPT_SET_1 1 << 0 -#define LLDB_OPT_SET_2 1 << 1 -#define LLDB_OPT_SET_3 1 << 2 -#define LLDB_OPT_SET_4 1 << 3 -#define LLDB_OPT_SET_5 1 << 4 -#define LLDB_OPT_SET_6 1 << 5 -#define LLDB_OPT_SET_7 1 << 6 -#define LLDB_OPT_SET_8 1 << 7 +#define LLDB_OPT_SET_ALL 0xFFFFFFFF +#define LLDB_OPT_SET_1 (1 << 0) +#define LLDB_OPT_SET_2 (1 << 1) +#define LLDB_OPT_SET_3 (1 << 2) +#define LLDB_OPT_SET_4 (1 << 3) +#define LLDB_OPT_SET_5 (1 << 4) +#define LLDB_OPT_SET_6 (1 << 5) +#define LLDB_OPT_SET_7 (1 << 6) +#define LLDB_OPT_SET_8 (1 << 7) #if defined(__cplusplus) From jmolenda at apple.com Tue Jun 15 16:20:35 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 15 Jun 2010 21:20:35 -0000 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h Message-ID: <20100615212035.3E0EB2A6C12C@llvm.org> Author: jmolenda Date: Tue Jun 15 16:20:35 2010 New Revision: 106045 URL: http://llvm.org/viewvc/llvm-project?rev=106045&view=rev Log: Add definition for DW_LANG_MIPS_Assembler. This file was originally generated by a script. I don't know if we're still regenerating it or not; will have to check with Greg about how he's handling this now. Should update it for the final DWARF3 and soon-to-be-released DWARF4 constants while I'm at it.. Modified: lldb/trunk/include/lldb/Core/dwarf.h Modified: lldb/trunk/include/lldb/Core/dwarf.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/dwarf.h?rev=106045&r1=106044&r2=106045&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/dwarf.h (original) +++ lldb/trunk/include/lldb/Core/dwarf.h Tue Jun 15 16:20:35 2010 @@ -449,23 +449,24 @@ /* [7.12] Figure 27 "Language encodings" (p. 143) in DWARFv3 draft 8 */ -#define DW_LANG_C89 0x1 -#define DW_LANG_C 0x2 -#define DW_LANG_Ada83 0x3 -#define DW_LANG_C_plus_plus 0x4 -#define DW_LANG_Cobol74 0x5 -#define DW_LANG_Cobol85 0x6 -#define DW_LANG_Fortran77 0x7 -#define DW_LANG_Fortran90 0x8 -#define DW_LANG_Pascal83 0x9 -#define DW_LANG_Modula2 0xA -#define DW_LANG_Java 0xB -#define DW_LANG_C99 0xC -#define DW_LANG_Ada95 0xD -#define DW_LANG_Fortran95 0xE -#define DW_LANG_PLI 0xF -#define DW_LANG_lo_user 0x8000 -#define DW_LANG_hi_user 0xFFFF +#define DW_LANG_C89 0x1 +#define DW_LANG_C 0x2 +#define DW_LANG_Ada83 0x3 +#define DW_LANG_C_plus_plus 0x4 +#define DW_LANG_Cobol74 0x5 +#define DW_LANG_Cobol85 0x6 +#define DW_LANG_Fortran77 0x7 +#define DW_LANG_Fortran90 0x8 +#define DW_LANG_Pascal83 0x9 +#define DW_LANG_Modula2 0xA +#define DW_LANG_Java 0xB +#define DW_LANG_C99 0xC +#define DW_LANG_Ada95 0xD +#define DW_LANG_Fortran95 0xE +#define DW_LANG_PLI 0xF +#define DW_LANG_lo_user 0x8000 +#define DW_LANG_hi_user 0xFFFF +#define DW_LANG_MIPS_Assembler 0x8001 /* [7.13], "Address Class Encodings" (p. 144) in DWARFv3 draft 8 */ From clattner at apple.com Tue Jun 15 16:43:08 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 15 Jun 2010 14:43:08 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: <20100615212035.3E0EB2A6C12C@llvm.org> References: <20100615212035.3E0EB2A6C12C@llvm.org> Message-ID: <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> On Jun 15, 2010, at 2:20 PM, Jason Molenda wrote: > Author: jmolenda > Date: Tue Jun 15 16:20:35 2010 > New Revision: 106045 > > URL: http://llvm.org/viewvc/llvm-project?rev=106045&view=rev > Log: > Add definition for DW_LANG_MIPS_Assembler. This file was originally > generated by a script. I don't know if we're still regenerating > it or not; will have to check with Greg about how he's handling this > now. Should update it for the final DWARF3 and soon-to-be-released > DWARF4 constants while I'm at it.. Hi Jason, Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? -Chris > > > Modified: > lldb/trunk/include/lldb/Core/dwarf.h > > Modified: lldb/trunk/include/lldb/Core/dwarf.h > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/dwarf.h?rev=106045&r1=106044&r2=106045&view=diff > ============================================================================== > --- lldb/trunk/include/lldb/Core/dwarf.h (original) > +++ lldb/trunk/include/lldb/Core/dwarf.h Tue Jun 15 16:20:35 2010 > @@ -449,23 +449,24 @@ > > /* [7.12] Figure 27 "Language encodings" (p. 143) in DWARFv3 draft 8 */ > > -#define DW_LANG_C89 0x1 > -#define DW_LANG_C 0x2 > -#define DW_LANG_Ada83 0x3 > -#define DW_LANG_C_plus_plus 0x4 > -#define DW_LANG_Cobol74 0x5 > -#define DW_LANG_Cobol85 0x6 > -#define DW_LANG_Fortran77 0x7 > -#define DW_LANG_Fortran90 0x8 > -#define DW_LANG_Pascal83 0x9 > -#define DW_LANG_Modula2 0xA > -#define DW_LANG_Java 0xB > -#define DW_LANG_C99 0xC > -#define DW_LANG_Ada95 0xD > -#define DW_LANG_Fortran95 0xE > -#define DW_LANG_PLI 0xF > -#define DW_LANG_lo_user 0x8000 > -#define DW_LANG_hi_user 0xFFFF > +#define DW_LANG_C89 0x1 > +#define DW_LANG_C 0x2 > +#define DW_LANG_Ada83 0x3 > +#define DW_LANG_C_plus_plus 0x4 > +#define DW_LANG_Cobol74 0x5 > +#define DW_LANG_Cobol85 0x6 > +#define DW_LANG_Fortran77 0x7 > +#define DW_LANG_Fortran90 0x8 > +#define DW_LANG_Pascal83 0x9 > +#define DW_LANG_Modula2 0xA > +#define DW_LANG_Java 0xB > +#define DW_LANG_C99 0xC > +#define DW_LANG_Ada95 0xD > +#define DW_LANG_Fortran95 0xE > +#define DW_LANG_PLI 0xF > +#define DW_LANG_lo_user 0x8000 > +#define DW_LANG_hi_user 0xFFFF > +#define DW_LANG_MIPS_Assembler 0x8001 > > /* [7.13], "Address Class Encodings" (p. 144) in DWARFv3 draft 8 */ > > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From resistor at mac.com Tue Jun 15 17:25:22 2010 From: resistor at mac.com (Owen Anderson) Date: Tue, 15 Jun 2010 15:25:22 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> Message-ID: <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> Ping? On Jun 11, 2010, at 2:40 PM, Owen Anderson wrote: > OK, so I did some measurement on this issue, using optimized (-Os) builds of LLDB, without debug symbols, targeting x86-64. > > When using qsort_r, Symtab.o is 43KB. > When using std::sort, Symtab.o is 46KB. > A 7% increase in file size on a single file. > > The qsort_r version of LLDB.framework is 32,840,512 bytes. > The std::sort version of LLDB.framework is 32,840,937 bytes. > A 0.001% increase in file size of the overall library. :-) > > Interestingly, it appears that those extra symbols get coalesced with ones already present (presumably in the LLVM libraries), so it doesn't actually add much at all to the resulting library. > > --Owen > > On Jun 11, 2010, at 2:03 PM, Jason Molenda wrote: > >> Please back this change out Owen, until you've addressed the point Greg made here - >> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000039.html >> >> J >> >> On Jun 11, 2010, at 1:52 PM, Owen Anderson wrote: >> >>> Author: resistor >>> Date: Fri Jun 11 15:52:57 2010 >>> New Revision: 105834 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=105834&view=rev >>> Log: >>> Replace qsort_r with std::sort. This gets rid of a lot of portability >>> ickiness, and is cleaner to boot. >>> >>> I'm fairly confident that I converted the comparator over properly, >>> and what testing I could figure out how to run seemed to pass, but it >>> would be great if someone in the know could check behind me. >>> >>> Modified: >>> lldb/trunk/include/lldb/Symbol/Symtab.h >>> lldb/trunk/source/Symbol/Symtab.cpp >>> >>> Modified: lldb/trunk/include/lldb/Symbol/Symtab.h >>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=105834&r1=105833&r2=105834&view=diff >>> ============================================================================== >>> --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) >>> +++ lldb/trunk/include/lldb/Symbol/Symtab.h Fri Jun 11 15:52:57 2010 >>> @@ -59,8 +59,6 @@ >>> typedef collection::iterator iterator; >>> typedef collection::const_iterator const_iterator; >>> >>> - static int CompareSymbolValueByIndex (void *thunk, const void *a, const void *b); >>> - static int CompareSymbolValueByIndexLinux (const void *a, const void *b, void *thunk); >>> void InitNameIndexes (); >>> void InitAddressIndexes (); >>> >>> >>> Modified: lldb/trunk/source/Symbol/Symtab.cpp >>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=105834&r1=105833&r2=105834&view=diff >>> ============================================================================== >>> --- lldb/trunk/source/Symbol/Symtab.cpp (original) >>> +++ lldb/trunk/source/Symbol/Symtab.cpp Fri Jun 11 15:52:57 2010 >>> @@ -214,46 +214,36 @@ >>> const Symbol *symbols; >>> }; >>> >>> -int >>> -Symtab::CompareSymbolValueByIndex (void *thunk, const void *a, const void *b) >>> -{ >>> - const Symbol *symbols = (const Symbol *)thunk; >>> - uint32_t index_a = *((uint32_t *) a); >>> - uint32_t index_b = *((uint32_t *) b); >>> - >>> - addr_t value_a; >>> - addr_t value_b; >>> - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) >>> - { >>> - value_a = symbols[index_a].GetValue ().GetOffset(); >>> - value_b = symbols[index_b].GetValue ().GetOffset(); >>> - } >>> - else >>> - { >>> - value_a = symbols[index_a].GetValue ().GetFileAddress(); >>> - value_b = symbols[index_b].GetValue ().GetFileAddress(); >>> - } >>> - >>> - if (value_a == value_b) >>> - { >>> - // The if the values are equal, use the original symbol user ID >>> - lldb::user_id_t uid_a = symbols[index_a].GetID(); >>> - lldb::user_id_t uid_b = symbols[index_b].GetID(); >>> - if (uid_a < uid_b) >>> - return -1; >>> - if (uid_a > uid_b) >>> - return 1; >>> - return 0; >>> - } >>> - else if (value_a < value_b) >>> - return -1; >>> - >>> - return 1; >>> -} >>> +namespace { >>> + struct SymbolIndexComparator { >>> + const std::vector& symbols; >>> + SymbolIndexComparator(const std::vector& s) : symbols(s) { } >>> + bool operator()(uint32_t index_a, uint32_t index_b) { >>> + addr_t value_a; >>> + addr_t value_b; >>> + if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { >>> + value_a = symbols[index_a].GetValue ().GetOffset(); >>> + value_b = symbols[index_b].GetValue ().GetOffset(); >>> + } else { >>> + value_a = symbols[index_a].GetValue ().GetFileAddress(); >>> + value_b = symbols[index_b].GetValue ().GetFileAddress(); >>> + } >>> >>> -int Symtab::CompareSymbolValueByIndexLinux(const void* a, const void* b, void* thunk) >>> -{ >>> - return CompareSymbolValueByIndex(thunk, a, b); >>> + if (value_a == value_b) { >>> + // The if the values are equal, use the original symbol user ID >>> + lldb::user_id_t uid_a = symbols[index_a].GetID(); >>> + lldb::user_id_t uid_b = symbols[index_b].GetID(); >>> + if (uid_a < uid_b) >>> + return true; >>> + if (uid_a > uid_b) >>> + return false; >>> + return false; >>> + } else if (value_a < value_b) >>> + return true; >>> + >>> + return false; >>> + } >>> + }; >>> } >>> >>> void >>> @@ -263,13 +253,8 @@ >>> if (indexes.size() <= 1) >>> return; >>> >>> - // Sort the indexes in place using qsort >>> - // FIXME: (WRONGDEFINE) Need a better define for this! >>> -#ifdef __APPLE__ >>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex); >>> -#else >>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), CompareSymbolValueByIndexLinux, (void *)&m_symbols[0]); >>> -#endif >>> + // Sort the indexes in place using std::sort >>> + std::sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); >>> >>> // Remove any duplicates if requested >>> if (remove_duplicates) >>> >>> >>> _______________________________________________ >>> lldb-commits mailing list >>> lldb-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >> > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From jmolenda at apple.com Tue Jun 15 17:39:36 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 15 Jun 2010 15:39:36 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> Message-ID: On Jun 15, 2010, at 2:43 PM, Chris Lattner wrote: > Hi Jason, > > Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? Yeah that would make sense. There are some random naming differences and a few DW_OP defines that llvm doesn't use but it shouldn't be much trouble to add the constants to llvm's copy and change lldb to use this. J From jingham at apple.com Tue Jun 15 17:56:20 2010 From: jingham at apple.com (Jim Ingham) Date: Tue, 15 Jun 2010 15:56:20 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> Message-ID: <4FE1AEAF-FAB3-4999-9DC5-D8B42B95BEC5@apple.com> Greg's on vacation this week. This is his area so if you don't mind it would be good to wait till he gets back and can take a look at it. Jim On Jun 15, 2010, at 3:25 PM, Owen Anderson wrote: > Ping? > > On Jun 11, 2010, at 2:40 PM, Owen Anderson wrote: > >> OK, so I did some measurement on this issue, using optimized (-Os) builds of LLDB, without debug symbols, targeting x86-64. >> >> When using qsort_r, Symtab.o is 43KB. >> When using std::sort, Symtab.o is 46KB. >> A 7% increase in file size on a single file. >> >> The qsort_r version of LLDB.framework is 32,840,512 bytes. >> The std::sort version of LLDB.framework is 32,840,937 bytes. >> A 0.001% increase in file size of the overall library. :-) >> >> Interestingly, it appears that those extra symbols get coalesced with ones already present (presumably in the LLVM libraries), so it doesn't actually add much at all to the resulting library. >> >> --Owen >> >> On Jun 11, 2010, at 2:03 PM, Jason Molenda wrote: >> >>> Please back this change out Owen, until you've addressed the point Greg made here - >>> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000039.html >>> >>> J >>> >>> On Jun 11, 2010, at 1:52 PM, Owen Anderson wrote: >>> >>>> Author: resistor >>>> Date: Fri Jun 11 15:52:57 2010 >>>> New Revision: 105834 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=105834&view=rev >>>> Log: >>>> Replace qsort_r with std::sort. This gets rid of a lot of portability >>>> ickiness, and is cleaner to boot. >>>> >>>> I'm fairly confident that I converted the comparator over properly, >>>> and what testing I could figure out how to run seemed to pass, but it >>>> would be great if someone in the know could check behind me. >>>> >>>> Modified: >>>> lldb/trunk/include/lldb/Symbol/Symtab.h >>>> lldb/trunk/source/Symbol/Symtab.cpp >>>> >>>> Modified: lldb/trunk/include/lldb/Symbol/Symtab.h >>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=105834&r1=105833&r2=105834&view=diff >>>> ============================================================================== >>>> --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) >>>> +++ lldb/trunk/include/lldb/Symbol/Symtab.h Fri Jun 11 15:52:57 2010 >>>> @@ -59,8 +59,6 @@ >>>> typedef collection::iterator iterator; >>>> typedef collection::const_iterator const_iterator; >>>> >>>> - static int CompareSymbolValueByIndex (void *thunk, const void *a, const void *b); >>>> - static int CompareSymbolValueByIndexLinux (const void *a, const void *b, void *thunk); >>>> void InitNameIndexes (); >>>> void InitAddressIndexes (); >>>> >>>> >>>> Modified: lldb/trunk/source/Symbol/Symtab.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=105834&r1=105833&r2=105834&view=diff >>>> ============================================================================== >>>> --- lldb/trunk/source/Symbol/Symtab.cpp (original) >>>> +++ lldb/trunk/source/Symbol/Symtab.cpp Fri Jun 11 15:52:57 2010 >>>> @@ -214,46 +214,36 @@ >>>> const Symbol *symbols; >>>> }; >>>> >>>> -int >>>> -Symtab::CompareSymbolValueByIndex (void *thunk, const void *a, const void *b) >>>> -{ >>>> - const Symbol *symbols = (const Symbol *)thunk; >>>> - uint32_t index_a = *((uint32_t *) a); >>>> - uint32_t index_b = *((uint32_t *) b); >>>> - >>>> - addr_t value_a; >>>> - addr_t value_b; >>>> - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) >>>> - { >>>> - value_a = symbols[index_a].GetValue ().GetOffset(); >>>> - value_b = symbols[index_b].GetValue ().GetOffset(); >>>> - } >>>> - else >>>> - { >>>> - value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>> - value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>> - } >>>> - >>>> - if (value_a == value_b) >>>> - { >>>> - // The if the values are equal, use the original symbol user ID >>>> - lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>> - lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>> - if (uid_a < uid_b) >>>> - return -1; >>>> - if (uid_a > uid_b) >>>> - return 1; >>>> - return 0; >>>> - } >>>> - else if (value_a < value_b) >>>> - return -1; >>>> - >>>> - return 1; >>>> -} >>>> +namespace { >>>> + struct SymbolIndexComparator { >>>> + const std::vector& symbols; >>>> + SymbolIndexComparator(const std::vector& s) : symbols(s) { } >>>> + bool operator()(uint32_t index_a, uint32_t index_b) { >>>> + addr_t value_a; >>>> + addr_t value_b; >>>> + if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { >>>> + value_a = symbols[index_a].GetValue ().GetOffset(); >>>> + value_b = symbols[index_b].GetValue ().GetOffset(); >>>> + } else { >>>> + value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>> + value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>> + } >>>> >>>> -int Symtab::CompareSymbolValueByIndexLinux(const void* a, const void* b, void* thunk) >>>> -{ >>>> - return CompareSymbolValueByIndex(thunk, a, b); >>>> + if (value_a == value_b) { >>>> + // The if the values are equal, use the original symbol user ID >>>> + lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>> + lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>> + if (uid_a < uid_b) >>>> + return true; >>>> + if (uid_a > uid_b) >>>> + return false; >>>> + return false; >>>> + } else if (value_a < value_b) >>>> + return true; >>>> + >>>> + return false; >>>> + } >>>> + }; >>>> } >>>> >>>> void >>>> @@ -263,13 +253,8 @@ >>>> if (indexes.size() <= 1) >>>> return; >>>> >>>> - // Sort the indexes in place using qsort >>>> - // FIXME: (WRONGDEFINE) Need a better define for this! >>>> -#ifdef __APPLE__ >>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex); >>>> -#else >>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), CompareSymbolValueByIndexLinux, (void *)&m_symbols[0]); >>>> -#endif >>>> + // Sort the indexes in place using std::sort >>>> + std::sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); >>>> >>>> // Remove any duplicates if requested >>>> if (remove_duplicates) >>>> >>>> >>>> _______________________________________________ >>>> lldb-commits mailing list >>>> lldb-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >>> >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From jingham at apple.com Tue Jun 15 21:00:15 2010 From: jingham at apple.com (Jim Ingham) Date: Wed, 16 Jun 2010 02:00:15 -0000 Subject: [Lldb-commits] [lldb] r106078 - in /lldb/trunk: include/lldb/ include/lldb/Breakpoint/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Breakpoint/ source/Commands/ source/Plugins/Process/MacOSX-User/source/ source/Plugins/Process/gdb-remote/ source/Target/ Message-ID: <20100616020016.0F9DC2A6C12C@llvm.org> Author: jingham Date: Tue Jun 15 21:00:15 2010 New Revision: 106078 URL: http://llvm.org/viewvc/llvm-project?rev=106078&view=rev Log: Add a "thread specification" class that specifies thread specific breakpoints by name, index, queue or TID. Push this through all the breakpoint management code. Allow this to be set when the breakpoint is created. Fix the Process classes so that a breakpoint hit that is not for a particular thread is not reported as a breakpoint hit event for that thread. Added a "breakpoint configure" command to allow you to reset any of the thread specific options (or the ignore count.) Added: lldb/trunk/include/lldb/Target/ThreadSpec.h lldb/trunk/source/Target/ThreadSpec.cpp Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBBreakpointLocation.cpp lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointList.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp lldb/trunk/source/Breakpoint/BreakpointOptions.cpp lldb/trunk/source/Breakpoint/BreakpointSite.cpp lldb/trunk/source/Breakpoint/StoppointLocation.cpp lldb/trunk/source/Breakpoint/WatchpointLocation.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp lldb/trunk/source/Commands/CommandObjectFile.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadPlan.cpp Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointList.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointList.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointList.h Tue Jun 15 21:00:15 2010 @@ -153,6 +153,15 @@ void ClearAllBreakpointSites (); + + //------------------------------------------------------------------ + /// Sets the passed in Locker to hold the Breakpoint List mutex. + /// + /// @param[in] locker + /// The locker object that is set. + //------------------------------------------------------------------ + void + GetListMutex (lldb_private::Mutex::Locker &locker); protected: typedef std::list bp_collection; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Tue Jun 15 21:00:15 2010 @@ -179,16 +179,6 @@ SetThreadID (lldb::tid_t thread_id); //------------------------------------------------------------------ - /// Return the current stop thread value. - /// - /// @return - /// The thread id for which the breakpoint hit will stop, - /// LLDB_INVALID_THREAD_ID for all threads. - //------------------------------------------------------------------ - lldb::tid_t - GetThreadID (); - - //------------------------------------------------------------------ // The next section deals with this location's breakpoint sites. //------------------------------------------------------------------ @@ -267,8 +257,11 @@ /// A pointer to the containing breakpoint's options if this /// location doesn't have its own copy. //------------------------------------------------------------------ - BreakpointOptions * - GetOptionsNoCopy (); + const BreakpointOptions * + GetOptionsNoCopy () const; + + bool + ValidForThisThread (Thread *thread); protected: friend class Breakpoint; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h Tue Jun 15 21:00:15 2010 @@ -156,6 +156,20 @@ /// @see lldb::DescriptionLevel //------------------------------------------------------------------ void GetDescription (Stream *s, lldb::DescriptionLevel level); + + //------------------------------------------------------------------ + /// Check whether this collection of breakpoint locations have any + /// thread specifiers, and if yes, is \a thread_id contained in any + /// of these specifiers. + /// + /// @param[in] thread + /// The thread against which to test. + /// + /// return + /// \b true if the collection contains at least one location that + /// would be valid for this thread, false otherwise. + //------------------------------------------------------------------ + bool ValidForThisThread (Thread *thread); Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Tue Jun 15 21:00:15 2010 @@ -12,6 +12,7 @@ // C Includes // C++ Includes +#include // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -84,6 +85,7 @@ return m_callback_is_synchronous; }; Baton *GetBaton (); + const Baton *GetBaton () const; void ClearCallback (); //------------------------------------------------------------------ @@ -122,21 +124,24 @@ //------------------------------------------------------------------ //------------------------------------------------------------------ - /// Return the current stop thread value. + /// Return the current thread spec. This is used to pass to Thread::MatchesSpec. /// @return - /// The thread id for which the breakpoint hit will stop, - /// LLDB_INVALID_THREAD_ID for all threads. + /// The thread specification pointer for this option, or NULL if none has + /// been set yet. //------------------------------------------------------------------ - lldb::tid_t - GetThreadID () const; + const ThreadSpec * + GetThreadSpec () const; //------------------------------------------------------------------ - /// Set the valid thread to be checked when the breakpoint is hit. - /// @param[in] thread_id - /// If this thread hits the breakpoint, we stop, otherwise not. + /// Returns a pointer to the ThreadSpec for this option, creating it. + /// if it hasn't been created already. This API is used for setting the + /// ThreadSpec items for this option. //------------------------------------------------------------------ + ThreadSpec * + GetThreadSpec (); + void - SetThreadID (lldb::tid_t thread_id); + SetThreadID(lldb::tid_t thread_id); //------------------------------------------------------------------ /// This is the default empty callback. @@ -201,7 +206,7 @@ bool m_callback_is_synchronous; bool m_enabled; int32_t m_ignore_count; // Number of times to ignore this breakpoint - lldb::tid_t m_thread_id; // Thread for which this breakpoint will take + std::auto_ptr m_thread_spec_ap; // Thread for which this breakpoint will take }; Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h Tue Jun 15 21:00:15 2010 @@ -182,6 +182,22 @@ //------------------------------------------------------------------ lldb::BreakpointLocationSP GetOwnerAtIndex (uint32_t index); + + //------------------------------------------------------------------ + /// Check whether the owners of this breakpoint site have any + /// thread specifiers, and if yes, is \a thread contained in any + /// of these specifiers. + /// + /// @param[in] thread + /// The thread against which to test. + /// + /// return + /// \b true if the collection contains at least one location that + /// would be valid for this thread, false otherwise. + //------------------------------------------------------------------ + bool + ValidForThisThread (Thread *thread); + //------------------------------------------------------------------ /// Print a description of this breakpoint site to the stream \a s. Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original) +++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Tue Jun 15 21:00:15 2010 @@ -28,12 +28,10 @@ //------------------------------------------------------------------ StoppointLocation (lldb::break_id_t bid, lldb::addr_t m_addr, - lldb::tid_t tid, bool hardware); StoppointLocation (lldb::break_id_t bid, lldb::addr_t m_addr, - lldb::tid_t tid, size_t size, bool hardware); @@ -62,9 +60,6 @@ uint32_t GetHardwareIndex () const; - lldb::tid_t - GetThreadID() const; - bool HardwarePreferred () const; @@ -88,7 +83,6 @@ // Classes that inherit from StoppointLocation can see and modify these //------------------------------------------------------------------ lldb::break_id_t m_loc_id; // Break ID - lldb::tid_t m_tid; // The thread ID if this stoppoint location is thread specific, or LLDB_INVALID_THREAD_ID if not thread specific. lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't // store a full Address since that's not needed for the breakpoint sites. bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources) Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Tue Jun 15 21:00:15 2010 @@ -262,6 +262,9 @@ lldb::Vote ShouldReportRun (Event *event_ptr); + + virtual bool + MatchesSpec (const ThreadSpec *spec); bool GetStopInfo (StopInfo *stop_info); Added: lldb/trunk/include/lldb/Target/ThreadSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadSpec.h?rev=106078&view=auto ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadSpec.h (added) +++ lldb/trunk/include/lldb/Target/ThreadSpec.h Tue Jun 15 21:00:15 2010 @@ -0,0 +1,134 @@ +//===-- ThreadSpec.h ------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ThreadSpec_h_ +#define liblldb_ThreadSpec_h_ + +#include +#include + +#include "lldb/lldb-private.h" + +namespace lldb_private { + +// Note: For now the thread spec has only fixed elements - +// Thread ID +// Thread Index +// Thread Name +// Thread Queue Name +// +// But if we need more generality, we can hang a key/value map off of this structure. +// That's why the thread matches spec test is done as a virtual method in Thread::MatchesSpec, +// since it is the native thread that would know how to interpret the keys. +// I was going to do the Queue Name this way out of sheer orneriness, but that seems a +// sufficiently general concept, so I put it in here on its own. + +class ThreadSpec +{ +public: + ThreadSpec (); + + ThreadSpec (const ThreadSpec &rhs); + + const ThreadSpec & + operator=(const ThreadSpec &rhs); + + void + SetIndex (uint32_t index) + { + m_index = index; + } + + void + SetTID (lldb::tid_t tid) + { + m_tid = tid; + } + + void + SetName (const char *name) + { + m_name = name; + } + + void + SetQueueName (const char *queue_name) + { + m_queue_name = queue_name; + } + + uint32_t + GetIndex () const + { + return m_index; + } + + lldb::tid_t + GetTID () const + { + return m_tid; + } + + const char * + GetName () const; + + const char * + GetQueueName () const; + + bool + TIDMatches (lldb::tid_t thread_id) const + { + if (m_tid == LLDB_INVALID_THREAD_ID || thread_id == LLDB_INVALID_THREAD_ID) + return true; + else + return thread_id == m_tid; + } + + bool + IndexMatches (uint32_t index) const + { + if (m_index == -1 || index == -1) + return true; + else + return index == m_index; + } + + bool + NameMatches (const char *name) const + { + if (m_name.empty()) + return true; + else if (name == NULL) + return false; + else + return m_name == name; + } + + bool + QueueNameMatches (const char *queue_name) const + { + if (m_queue_name.empty()) + return true; + else if (queue_name == NULL) + return false; + else + return m_queue_name == queue_name; + } + +protected: +private: + uint32_t m_index; + lldb::tid_t m_tid; + std::string m_name; + std::string m_queue_name; +}; + +} // namespace lldb_private + +#endif // liblldb_ThreadSpec_h_ Modified: lldb/trunk/include/lldb/lldb-forward.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-forward.h (original) +++ lldb/trunk/include/lldb/lldb-forward.h Tue Jun 15 21:00:15 2010 @@ -129,6 +129,7 @@ class ThreadPlanStepThrough; class ThreadPlanStepRange; class ThreadPlanRunToAddress; +class ThreadSpec; class TimeValue; class Type; class TypeList; Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Jun 15 21:00:15 2010 @@ -335,6 +335,8 @@ 49D7072911B5AD11001AD875 /* ClangASTSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D7072811B5AD11001AD875 /* ClangASTSource.cpp */; settings = {COMPILER_FLAGS = "-fno-rtti"; }; }; 49F1A74611B3388F003ED505 /* ClangExpressionDeclMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */; }; 49F1A74A11B338AE003ED505 /* ClangExpressionDeclMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */; }; + 4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; }; + 4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */; }; 4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CA9637911B6E99A00780E28 /* CommandObjectApropos.cpp */; }; 4CA9637C11B6E99A00780E28 /* CommandObjectApropos.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CA9637A11B6E99A00780E28 /* CommandObjectApropos.h */; }; 9A19A6AF1163BBB200E0D453 /* SBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A19A6A51163BB7E00E0D453 /* SBValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -920,6 +922,8 @@ 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangExpressionDeclMap.h; path = include/lldb/Expression/ClangExpressionDeclMap.h; sourceTree = ""; }; 4C00986F11500B4300F316B0 /* UnixSignals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnixSignals.h; path = include/lldb/Target/UnixSignals.h; sourceTree = ""; }; 4C00987011500B4300F316B0 /* UnixSignals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UnixSignals.cpp; path = source/Target/UnixSignals.cpp; sourceTree = ""; }; + 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadSpec.cpp; path = source/Target/ThreadSpec.cpp; sourceTree = ""; }; + 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadSpec.h; path = include/lldb/Target/ThreadSpec.h; sourceTree = ""; }; 4C09CB73116BD98B00C7A725 /* CommandCompletions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandCompletions.h; path = include/lldb/Interpreter/CommandCompletions.h; sourceTree = ""; }; 4C09CB74116BD98B00C7A725 /* CommandCompletions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandCompletions.cpp; path = source/Commands/CommandCompletions.cpp; sourceTree = ""; }; 4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanShouldStopHere.h; path = include/lldb/Target/ThreadPlanShouldStopHere.h; sourceTree = ""; }; @@ -1963,6 +1967,8 @@ 260C847510F50EFC00BB2B04 /* ThreadPlanStepThrough.cpp */, 4CEDAED311754F5E00E875A6 /* ThreadPlanStepUntil.h */, 2660D9FE11922A7F00958FBD /* ThreadPlanStepUntil.cpp */, + 4C08CDEB11C81F1E001610A8 /* ThreadSpec.h */, + 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */, 4C00986F11500B4300F316B0 /* UnixSignals.h */, 4C00987011500B4300F316B0 /* UnixSignals.cpp */, 26E3EEBD11A9870400FBADB6 /* Unwind.h */, @@ -2199,6 +2205,7 @@ 49D7072711B5AD03001AD875 /* ClangASTSource.h in Headers */, 4CA9637C11B6E99A00780E28 /* CommandObjectApropos.h in Headers */, 261B5A5511C3F2AD00AABD0A /* SharingPtr.h in Headers */, + 4C08CDEC11C81F1E001610A8 /* ThreadSpec.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2651,6 +2658,7 @@ 4CA9637B11B6E99A00780E28 /* CommandObjectApropos.cpp in Sources */, AF94005911C03F6500085DB9 /* SymbolVendor.cpp in Sources */, 261B5A5411C3F2AD00AABD0A /* SharingPtr.cpp in Sources */, + 4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Tue Jun 15 21:00:15 2010 @@ -14,6 +14,7 @@ #include "lldb/lldb-types.h" #include "lldb/lldb-defines.h" #include "lldb/Breakpoint/BreakpointLocation.h" +#include "lldb/Target/ThreadSpec.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" @@ -102,7 +103,7 @@ { tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID; if (m_break_loc_sp) - sb_thread_id = m_break_loc_sp->GetThreadID(); + sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->GetTID(); return sb_thread_id; } Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Tue Jun 15 21:00:15 2010 @@ -24,6 +24,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" +#include "lldb/Target/ThreadSpec.h" #include "lldb/lldb-private-log.h" using namespace lldb; @@ -166,13 +167,16 @@ void Breakpoint::SetThreadID (lldb::tid_t thread_id) { - m_options.SetThreadID(thread_id); + m_options.GetThreadSpec()->SetTID(thread_id); } lldb::tid_t Breakpoint::GetThreadID () { - return m_options.GetThreadID(); + if (m_options.GetThreadSpec() == NULL) + return LLDB_INVALID_THREAD_ID; + else + return m_options.GetThreadSpec()->GetTID(); } // This function is used when "baton" doesn't need to be freed Modified: lldb/trunk/source/Breakpoint/BreakpointList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointList.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointList.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointList.cpp Tue Jun 15 21:00:15 2010 @@ -196,3 +196,9 @@ (*pos)->ClearAllBreakpointSites (); } + +void +BreakpointList::GetListMutex (Mutex::Locker &locker) +{ + return locker.Reset (m_mutex.GetMutex()); +} Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Tue Jun 15 21:00:15 2010 @@ -22,6 +22,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/lldb-private-log.h" #include "lldb/Target/Thread.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -34,12 +35,13 @@ lldb::tid_t tid, bool hardware ) : - StoppointLocation (loc_id, addr.GetLoadAddress(owner.GetTarget().GetProcessSP().get()), tid, hardware), + StoppointLocation (loc_id, addr.GetLoadAddress(owner.GetTarget().GetProcessSP().get()), hardware), m_address (addr), m_owner (owner), m_options_ap (), m_bp_site_sp () { + SetThreadID (tid); } BreakpointLocation::~BreakpointLocation() @@ -93,13 +95,15 @@ void BreakpointLocation::SetThreadID (lldb::tid_t thread_id) { - GetLocationOptions()->SetThreadID(thread_id); -} - -lldb::tid_t -BreakpointLocation::GetThreadID () -{ - return GetOptionsNoCopy()->GetThreadID(); + if (thread_id != LLDB_INVALID_THREAD_ID) + GetLocationOptions()->SetThreadID(thread_id); + else + { + // If we're resetting this to an invalid thread id, then + // don't make an options pointer just to do that. + if (m_options_ap.get() != NULL) + m_options_ap->SetThreadID (thread_id); + } } bool @@ -150,8 +154,8 @@ GetLocationOptions()->SetIgnoreCount(n); } -BreakpointOptions * -BreakpointLocation::GetOptionsNoCopy () +const BreakpointOptions * +BreakpointLocation::GetOptionsNoCopy () const { if (m_options_ap.get() != NULL) return m_options_ap.get(); @@ -168,8 +172,16 @@ return m_options_ap.get(); } +bool +BreakpointLocation::ValidForThisThread (Thread *thread) +{ + return thread->MatchesSpec(GetOptionsNoCopy()->GetThreadSpec()); +} + // RETURNS - true if we should stop at this breakpoint, false if we -// should continue. +// should continue. Note, we don't check the thread spec for the breakpoint +// here, since if the breakpoint is not for this thread, then the event won't +// even get reported, so the check is redundant. bool BreakpointLocation::ShouldStop (StoppointCallbackContext *context) @@ -181,10 +193,6 @@ if (!IsEnabled()) return false; - if (GetThreadID() != LLDB_INVALID_THREAD_ID - && context->context.thread->GetID() != GetThreadID()) - return false; - if (m_hit_count <= GetIgnoreCount()) return false; @@ -379,7 +387,7 @@ s->Printf("BreakpointLocation %u: tid = %4.4x load addr = 0x%8.8llx state = %s type = %s breakpoint hw_index = %i hit_count = %-4u ignore_count = %-4u", GetID(), - m_tid, + GetOptionsNoCopy()->GetThreadSpec()->GetTID(), (uint64_t) m_address.GetLoadAddress(m_owner.GetTarget().GetProcessSP().get()), (m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled", IsHardware() ? "hardware" : "software", Modified: lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocationCollection.cpp Tue Jun 15 21:00:15 2010 @@ -16,6 +16,8 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointLocationList.h" +#include "lldb/Target/Thread.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -145,6 +147,22 @@ return shouldStop; } +bool +BreakpointLocationCollection::ValidForThisThread (Thread *thread) +{ + collection::iterator pos, + begin = m_break_loc_collection.begin(), + end = m_break_loc_collection.end(); + + for (pos = begin; pos != end; ++pos) + { + if ((*pos)->ValidForThisThread (thread)) + return true; + } + return false; +} + + void BreakpointLocationCollection::GetDescription (Stream *s, lldb::DescriptionLevel level) { Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Tue Jun 15 21:00:15 2010 @@ -16,6 +16,7 @@ #include "lldb/Core/Stream.h" #include "lldb/Core/StringList.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -35,7 +36,7 @@ m_callback_baton_sp (), m_enabled (true), m_ignore_count (0), - m_thread_id (LLDB_INVALID_THREAD_ID) + m_thread_spec_ap (NULL) { } @@ -48,8 +49,10 @@ m_callback_is_synchronous (rhs.m_callback_is_synchronous), m_enabled (rhs.m_enabled), m_ignore_count (rhs.m_ignore_count), - m_thread_id (rhs.m_thread_id) + m_thread_spec_ap (NULL) { + if (rhs.m_thread_spec_ap.get() != NULL) + m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get())); } //---------------------------------------------------------------------- @@ -63,7 +66,8 @@ m_callback_is_synchronous = rhs.m_callback_is_synchronous; m_enabled = rhs.m_enabled; m_ignore_count = rhs.m_ignore_count; - m_thread_id = rhs.m_thread_id; + if (rhs.m_thread_spec_ap.get() != NULL) + m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get())); return *this; } @@ -98,6 +102,12 @@ return m_callback_baton_sp.get(); } +const Baton * +BreakpointOptions::GetBaton () const +{ + return m_callback_baton_sp.get(); +} + bool BreakpointOptions::InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t break_id, @@ -141,19 +151,26 @@ m_ignore_count = n; } -void -BreakpointOptions::SetThreadID (lldb::tid_t thread_id) +const ThreadSpec * +BreakpointOptions::GetThreadSpec () const { - m_thread_id = thread_id; + return m_thread_spec_ap.get(); } -lldb::tid_t -BreakpointOptions::GetThreadID () const +ThreadSpec * +BreakpointOptions::GetThreadSpec () { - return m_thread_id; + if (m_thread_spec_ap.get() == NULL) + m_thread_spec_ap.reset (new ThreadSpec()); + + return m_thread_spec_ap.get(); } - +void +BreakpointOptions::SetThreadID (lldb::tid_t thread_id) +{ + GetThreadSpec()->SetTID(thread_id); +} void BreakpointOptions::CommandBaton::GetDescription (Stream *s, lldb::DescriptionLevel level) const Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Tue Jun 15 21:00:15 2010 @@ -80,9 +80,8 @@ if (s == NULL) return; - s->Printf("BreakpointSite %u: tid = %4.4x addr = 0x%8.8llx type = %s breakpoint hw_index = %i hit_count = %-4u", + s->Printf("BreakpointSite %u: addr = 0x%8.8llx type = %s breakpoint hw_index = %i hit_count = %-4u", GetID(), - m_tid, (uint64_t)m_addr, IsHardware() ? "hardware" : "software", GetHardwareIndex(), @@ -178,6 +177,12 @@ } bool +BreakpointSite::ValidForThisThread (Thread *thread) +{ + return m_owners.ValidForThisThread(thread); +} + +bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *intersect_addr, size_t *intersect_size, size_t *opcode_offset) const { // We only use software traps for software breakpoints Modified: lldb/trunk/source/Breakpoint/StoppointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/StoppointLocation.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/StoppointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/StoppointLocation.cpp Tue Jun 15 21:00:15 2010 @@ -20,9 +20,8 @@ //---------------------------------------------------------------------- // StoppointLocation constructor //---------------------------------------------------------------------- -StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, tid_t tid, bool hardware) : +StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, bool hardware) : m_loc_id(bid), - m_tid(tid), m_byte_size(0), m_addr(addr), m_hit_count(0), @@ -31,9 +30,8 @@ { } -StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, tid_t tid, size_t size, bool hardware) : +StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, size_t size, bool hardware) : m_loc_id(bid), - m_tid(tid), m_byte_size(size), m_addr(addr), m_hit_count(0), @@ -62,12 +60,6 @@ return m_addr; } -tid_t -StoppointLocation::GetThreadID() const -{ - return m_tid; -} - uint32_t StoppointLocation::GetHitCount () const { Modified: lldb/trunk/source/Breakpoint/WatchpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointLocation.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/WatchpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/WatchpointLocation.cpp Tue Jun 15 21:00:15 2010 @@ -79,7 +79,6 @@ s->Printf("WatchpointLocation %u: tid = %4.4x addr = 0x%8.8llx size = %zu state = %s type = %s watchpoint (%s%s) hw_index = %i hit_count = %-4u ignore_count = %-4u callback = %8p baton = %8p", GetID(), - m_tid, (uint64_t)m_addr, m_byte_size, m_enabled ? "enabled " : "disabled", Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Jun 15 21:00:15 2010 @@ -25,6 +25,8 @@ #include "lldb/Target/Target.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Target/StackFrame.h" +#include "lldb/Target/Thread.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -51,9 +53,13 @@ m_func_name (), m_func_regexp (), m_modules (), - m_load_addr() + m_load_addr(), + m_thread_id(LLDB_INVALID_THREAD_ID), + m_thread_index (-1), + m_thread_name(), + m_queue_name(), + m_ignore_count (-1) { - BuildValidOptionSets(); } CommandObjectBreakpointSet::CommandOptions::~CommandOptions () @@ -69,6 +75,21 @@ { LLDB_OPT_SET_ALL, false, "ignore_inlines", 'i', no_argument, NULL, 0, NULL, "Ignore inlined subroutines when setting the breakppoint." }, + { LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, NULL, + "Set the number of times this breakpoint is sKipped before stopping." }, + + { LLDB_OPT_SET_ALL, false, "thread_index", 'x', required_argument, NULL, NULL, "", + "The breakpoint stops only for the thread whose indeX matches this argument."}, + + { LLDB_OPT_SET_ALL, false, "thread_id", 't', required_argument, NULL, NULL, "", + "The breakpoint stops only for the thread whose TID matches this argument."}, + + { LLDB_OPT_SET_ALL, false, "thread_name", 'T', required_argument, NULL, NULL, "", + "The breakpoint stops only for the thread whose thread name matches this argument."}, + + { LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "", + "The breakpoint stops only for threads in the queue whose name is given by this argument."}, + { LLDB_OPT_SET_1, false, "file", 'f', required_argument, NULL, CommandCompletions::eSourceFileCompletion, "", "Set the breakpoint by source location in this particular file."}, @@ -138,6 +159,33 @@ m_modules.push_back (std::string (option_arg)); break; } + case 'k': + { + m_ignore_count = Args::StringToSInt32(optarg, -1, 0); + if (m_ignore_count == -1) + error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); + } + case 't' : + { + m_thread_id = Args::StringToUInt64(optarg, LLDB_INVALID_THREAD_ID, 0); + if (m_thread_id == LLDB_INVALID_THREAD_ID) + error.SetErrorStringWithFormat ("Invalid thread id string '%s'.\n", optarg); + } + break; + case 'T': + m_thread_name = option_arg; + break; + case 'q': + m_queue_name = option_arg; + break; + case 'x': + { + m_thread_index = Args::StringToUInt64(optarg, -1, 0); + if (m_thread_id == -1) + error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg); + + } + break; default: error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); break; @@ -159,6 +207,11 @@ m_func_regexp.clear(); m_load_addr = LLDB_INVALID_ADDRESS; m_modules.clear(); + m_ignore_count = -1; + m_thread_id = LLDB_INVALID_THREAD_ID; + m_thread_index = -1; + m_thread_name.clear(); + m_queue_name.clear(); } //------------------------------------------------------------------------- @@ -223,7 +276,7 @@ if ((num_modules > 0) && (break_type != eSetTypeAddress)) use_module = true; - + switch (break_type) { case eSetTypeFileAndLine: // Breakpoint by source position @@ -361,6 +414,25 @@ break; } + // Now set the various options that were passed in: + if (bp) + { + if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) + bp->SetThreadID (m_options.m_thread_id); + + if (m_options.m_thread_index != -1) + bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); + + if (!m_options.m_thread_name.empty()) + bp->GetOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); + + if (!m_options.m_queue_name.empty()) + bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); + + if (m_options.m_ignore_count != -1) + bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count); + } + if (bp && !use_module) { StreamString &output_stream = result.GetOutputStream(); @@ -378,8 +450,6 @@ return result.Succeeded(); } - - //------------------------------------------------------------------------- // CommandObjectMultiwordBreakpoint //------------------------------------------------------------------------- @@ -397,12 +467,14 @@ CommandObjectSP disable_command_object (new CommandObjectBreakpointDisable ()); CommandObjectSP set_command_object (new CommandObjectBreakpointSet ()); CommandObjectSP command_command_object (new CommandObjectBreakpointCommand (interpreter)); + CommandObjectSP configure_command_object (new CommandObjectBreakpointConfigure()); enable_command_object->SetCommandName("breakpoint enable"); disable_command_object->SetCommandName("breakpoint disable"); set_command_object->SetCommandName("breakpoint set"); command_command_object->SetCommandName ("breakpoint command"); list_command_object->SetCommandName ("breakpoint list"); + configure_command_object->SetCommandName ("breakpoint configure"); status = LoadSubCommand (list_command_object, "list", interpreter); status = LoadSubCommand (enable_command_object, "enable", interpreter); @@ -410,6 +482,7 @@ status = LoadSubCommand (delete_command_object, "delete", interpreter); status = LoadSubCommand (set_command_object, "set", interpreter); status = LoadSubCommand (command_command_object, "command", interpreter); + status = LoadSubCommand (configure_command_object, "configure", interpreter); } CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint () @@ -481,7 +554,6 @@ Options (), m_level (lldb::eDescriptionLevelFull) // Breakpoint List defaults to brief descriptions { - BuildValidOptionSets(); } CommandObjectBreakpointList::CommandOptions::~CommandOptions () @@ -590,6 +662,9 @@ } const BreakpointList &breakpoints = target->GetBreakpointList(m_options.m_internal); + Mutex::Locker locker; + target->GetBreakpointList(m_options.m_internal).GetListMutex(locker); + size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) @@ -672,7 +747,11 @@ return false; } + Mutex::Locker locker; + target->GetBreakpointList().GetListMutex(locker); + const BreakpointList &breakpoints = target->GetBreakpointList(); + size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) @@ -771,6 +850,9 @@ return false; } + Mutex::Locker locker; + target->GetBreakpointList().GetListMutex(locker); + const BreakpointList &breakpoints = target->GetBreakpointList(); size_t num_breakpoints = breakpoints.GetSize(); @@ -866,7 +948,11 @@ return false; } + Mutex::Locker locker; + target->GetBreakpointList().GetListMutex(locker); + const BreakpointList &breakpoints = target->GetBreakpointList(); + size_t num_breakpoints = breakpoints.GetSize(); if (num_breakpoints == 0) @@ -931,3 +1017,210 @@ } return result.Succeeded(); } + +//------------------------------------------------------------------------- +// CommandObjectBreakpointConfigure::CommandOptions +//------------------------------------------------------------------------- + +CommandObjectBreakpointConfigure::CommandOptions::CommandOptions() : + Options (), + m_thread_id(LLDB_INVALID_THREAD_ID), + m_thread_index (-1), + m_thread_name(), + m_queue_name(), + m_ignore_count (-1) +{ +} + +CommandObjectBreakpointConfigure::CommandOptions::~CommandOptions () +{ +} + +lldb::OptionDefinition +CommandObjectBreakpointConfigure::CommandOptions::g_option_table[] = +{ + { LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, NULL, + "Set the number of times this breakpoint is sKipped before stopping." }, + + { LLDB_OPT_SET_ALL, false, "thread_index", 'x', required_argument, NULL, NULL, "", + "The breakpoint stops only for the thread whose indeX matches this argument."}, + + { LLDB_OPT_SET_ALL, false, "thread_id", 't', required_argument, NULL, NULL, "", + "The breakpoint stops only for the thread whose TID matches this argument."}, + + { LLDB_OPT_SET_ALL, false, "thread_name", 'T', required_argument, NULL, NULL, "", + "The breakpoint stops only for the thread whose thread name matches this argument."}, + + { LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "", + "The breakpoint stops only for threads in the queue whose name is given by this argument."}, + + { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } +}; + +const lldb::OptionDefinition* +CommandObjectBreakpointConfigure::CommandOptions::GetDefinitions () +{ + return g_option_table; +} + +Error +CommandObjectBreakpointConfigure::CommandOptions::SetOptionValue (int option_idx, const char *option_arg) +{ + Error error; + char short_option = (char) m_getopt_table[option_idx].val; + + switch (short_option) + { + case 'k': + { + m_ignore_count = Args::StringToSInt32(optarg, -1, 0); + if (m_ignore_count == -1) + error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); + } + case 't' : + { + m_thread_id = Args::StringToUInt64(optarg, LLDB_INVALID_THREAD_ID, 0); + if (m_thread_id == LLDB_INVALID_THREAD_ID) + error.SetErrorStringWithFormat ("Invalid thread id string '%s'.\n", optarg); + } + break; + case 'T': + m_thread_name = option_arg; + break; + case 'q': + m_queue_name = option_arg; + break; + case 'x': + { + m_thread_index = Args::StringToUInt64(optarg, -1, 0); + if (m_thread_id == -1) + error.SetErrorStringWithFormat ("Invalid thread index string '%s'.\n", optarg); + + } + break; + default: + error.SetErrorStringWithFormat ("Unrecognized option '%c'.\n", short_option); + break; + } + + return error; +} + +void +CommandObjectBreakpointConfigure::CommandOptions::ResetOptionValues () +{ + Options::ResetOptionValues(); + + m_ignore_count = -1; + m_thread_id = LLDB_INVALID_THREAD_ID; + m_thread_index = -1; + m_thread_name.clear(); + m_queue_name.clear(); +} + +//------------------------------------------------------------------------- +// CommandObjectBreakpointSet +//------------------------------------------------------------------------- + +CommandObjectBreakpointConfigure::CommandObjectBreakpointConfigure () : + CommandObject ("breakpoint configure", "Configures the options on a breakpoint or set of breakpoints in the executable.", + "breakpoint configure break-id [break-id ...]") +{ +} + +CommandObjectBreakpointConfigure::~CommandObjectBreakpointConfigure () +{ +} + +Options * +CommandObjectBreakpointConfigure::GetOptions () +{ + return &m_options; +} + +bool +CommandObjectBreakpointConfigure::Execute +( + Args& command, + CommandContext *context, + CommandInterpreter *interpreter, + CommandReturnObject &result +) +{ + if (command.GetArgumentCount() == 0) + { + result.AppendError ("No breakpoints specified."); + result.SetStatus (eReturnStatusFailed); + return false; + } + + Target *target = context->GetTarget(); + if (target == NULL) + { + result.AppendError ("Invalid target, set executable file using 'file' command."); + result.SetStatus (eReturnStatusFailed); + return false; + } + + Mutex::Locker locker; + target->GetBreakpointList().GetListMutex(locker); + + BreakpointIDList valid_bp_ids; + + CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (command, target, result, &valid_bp_ids); + + if (result.Succeeded()) + { + for (int i = 0; i < valid_bp_ids.Size(); ++i) + { + BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i); + + if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) + { + Breakpoint *bp = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get(); + if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) + { + BreakpointLocation *location = bp->FindLocationByID (cur_bp_id.GetLocationID()).get(); + if (location) + { + if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) + location->SetThreadID (m_options.m_thread_id); + + if (m_options.m_thread_index != -1) + location->GetLocationOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); + + if (!m_options.m_thread_name.empty()) + location->GetLocationOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); + + if (!m_options.m_queue_name.empty()) + location->GetLocationOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); + + if (m_options.m_ignore_count != -1) + location->GetLocationOptions()->SetIgnoreCount(m_options.m_ignore_count); + } + } + else + { + if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID) + bp->SetThreadID (m_options.m_thread_id); + + if (m_options.m_thread_index != -1) + bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); + + if (!m_options.m_thread_name.empty()) + bp->GetOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); + + if (!m_options.m_queue_name.empty()) + bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); + + if (m_options.m_ignore_count != -1) + bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count); + } + } + } + } + + return result.Succeeded(); +} + + Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Tue Jun 15 21:00:15 2010 @@ -106,6 +106,70 @@ std::string m_func_regexp; lldb::addr_t m_load_addr; STLStringArray m_modules; + int32_t m_ignore_count; + lldb::tid_t m_thread_id; + uint32_t m_thread_index; + std::string m_thread_name; + std::string m_queue_name; + + }; + +private: + CommandOptions m_options; +}; + +//------------------------------------------------------------------------- +// CommandObjectMultiwordBreakpointConfigure +//------------------------------------------------------------------------- + + +class CommandObjectBreakpointConfigure : public CommandObject +{ +public: + + CommandObjectBreakpointConfigure (); + + virtual + ~CommandObjectBreakpointConfigure (); + + virtual bool + Execute (Args& command, + CommandContext *context, + CommandInterpreter *interpreter, + CommandReturnObject &result); + + virtual Options * + GetOptions (); + + class CommandOptions : public Options + { + public: + + CommandOptions (); + + virtual + ~CommandOptions (); + + virtual Error + SetOptionValue (int option_idx, const char *option_arg); + + void + ResetOptionValues (); + + const lldb::OptionDefinition* + GetDefinitions (); + + // Options table: Required for subclasses of Options. + + static lldb::OptionDefinition g_option_table[]; + + // Instance variables to hold the values for command options. + + int32_t m_ignore_count; + lldb::tid_t m_thread_id; + uint32_t m_thread_index; + std::string m_thread_name; + std::string m_queue_name; }; Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Tue Jun 15 21:00:15 2010 @@ -34,7 +34,6 @@ CommandObjectBreakpointCommandAdd::CommandOptions::CommandOptions () : Options () { - BuildValidOptionSets(); } CommandObjectBreakpointCommandAdd::CommandOptions::~CommandOptions () @@ -532,7 +531,7 @@ if (bp) { - BreakpointOptions *bp_options = NULL; + const BreakpointOptions *bp_options = NULL; if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) { BreakpointLocationSP bp_loc_sp(bp->FindLocationByID (cur_bp_id.GetLocationID())); @@ -556,7 +555,7 @@ { StreamString id_str; BreakpointID::GetCanonicalReference (&id_str, cur_bp_id.GetBreakpointID(), cur_bp_id.GetLocationID()); - Baton *baton = bp_options->GetBaton(); + const Baton *baton = bp_options->GetBaton(); if (baton) { result.GetOutputStream().Printf ("Breakpoint %s:\n", id_str.GetData()); Modified: lldb/trunk/source/Commands/CommandObjectFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFile.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectFile.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectFile.cpp Tue Jun 15 21:00:15 2010 @@ -28,7 +28,6 @@ Options (), m_arch () // Breakpoint info defaults to brief descriptions { - BuildValidOptionSets(); } CommandObjectFile::CommandOptions::~CommandOptions () Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp Tue Jun 15 21:00:15 2010 @@ -1000,16 +1000,20 @@ if (bp_site->HardwarePreferred()) { - ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(bp_site->GetThreadID()).get(); - if (thread) - { - bp_site->SetHardwareIndex (thread->SetHardwareBreakpoint(bp_site)); - if (bp_site->IsHardware()) - { - bp_site->SetEnabled(true); - return error; - } - } + // FIXME: This code doesn't make sense. Breakpoint sites don't really have single ThreadID's, since one site could be + // owned by a number of Locations, each with a different Thread ID. So either this should run over all the Locations and + // set it for all threads owned by those locations, or set it for all threads, and let the thread specific code sort it out. + +// ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(bp_site->GetThreadID()).get(); +// if (thread) +// { +// bp_site->SetHardwareIndex (thread->SetHardwareBreakpoint(bp_site)); +// if (bp_site->IsHardware()) +// { +// bp_site->SetEnabled(true); +// return error; +// } +// } } // Just let lldb::Process::EnableSoftwareBreakpoint() handle everything... @@ -1030,17 +1034,6 @@ if (bp_site->IsHardware()) { - ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(bp_site->GetThreadID()).get(); - if (thread) - { - if (thread->ClearHardwareBreakpoint(bp_site)) - { - bp_site->SetEnabled(false); - if (log) - log->Printf ("ProcessMacOSX::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx -- SUCCESS (hardware)", site_id, (uint64_t)addr); - return error; - } - } error.SetErrorString("hardware breakpoints are no supported"); return error; } @@ -1068,20 +1061,8 @@ } else { - ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(wp->GetThreadID()).get(); - if (thread) - { - wp->SetHardwareIndex (thread->SetHardwareWatchpoint (wp)); - if (wp->IsHardware ()) - { - wp->SetEnabled(true); - return error; - } - } - else - { - error.SetErrorString("Watchpoints currently only support thread specific watchpoints."); - } + // Watchpoints aren't supported at present. + error.SetErrorString("Watchpoints aren't currently supported."); } } return error; @@ -1103,17 +1084,7 @@ if (wp->IsHardware()) { - ThreadMacOSX *thread = (ThreadMacOSX *)m_thread_list.FindThreadByID(wp->GetThreadID()).get(); - if (thread) - { - if (thread->ClearHardwareWatchpoint (wp)) - { - wp->SetEnabled(false); - if (log) - log->Printf ("ProcessMacOSX::Disablewatchpoint (watchID = %d) addr = 0x%8.8llx (hardware) => success", watchID, (uint64_t)addr); - return error; - } - } + error.SetErrorString("Watchpoints aren't currently supported."); } // TODO: clear software watchpoints if we implement them error.SetErrorToGenericError(); Modified: lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp Tue Jun 15 21:00:15 2010 @@ -81,11 +81,19 @@ if (data_0 == MACH_SOFTWARE_BREAKPOINT_DATA_0) { lldb::addr_t pc = GetRegisterContext()->GetPC(); - lldb::user_id_t break_id = m_process.GetBreakpointSiteList().FindIDByAddress(pc); - if (break_id != LLDB_INVALID_BREAK_ID) + lldb::BreakpointSiteSP bp_site_sp = m_process.GetBreakpointSiteList().FindByAddress(pc); + if (bp_site_sp) { - stop_info->Clear (); - stop_info->SetStopReasonWithBreakpointSiteID (break_id); + if (bp_site_sp->ValidForThisThread (this)) + { + stop_info->Clear (); + stop_info->SetStopReasonWithBreakpointSiteID (GetID()); + } + else + { + stop_info->Clear (); + stop_info->SetStopReasonToNone(); + } return success; } } Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Tue Jun 15 21:00:15 2010 @@ -1034,8 +1034,8 @@ else if (exc_type == EXC_BREAKPOINT && exc_data[0] == MACH_EXC_DATA0_SOFTWARE_BREAKPOINT) { addr_t pc = gdb_thread->GetRegisterContext()->GetPC(); - user_id_t break_id = GetBreakpointSiteList().FindIDByAddress(pc); - if (break_id == LLDB_INVALID_BREAK_ID) + lldb::BreakpointSiteSP bp_site_sp = GetBreakpointSiteList().FindByAddress(pc); + if (!bp_site_sp) { //log->Printf("got EXC_BREAKPOINT at 0x%llx but didn't find a breakpoint site.\n", pc); stop_info.SetStopReasonWithException(exc_type, exc_data.size()); @@ -1044,8 +1044,17 @@ } else { - stop_info.Clear (); - stop_info.SetStopReasonWithBreakpointSiteID (break_id); + if (bp_site_sp->ValidForThisThread (thread_sp.get())) + { + stop_info.Clear (); + stop_info.SetStopReasonWithBreakpointSiteID (bp_site_sp->GetID()); + } + else + { + stop_info.Clear (); + stop_info.SetStopReasonToNone(); + } + } } #endif Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Tue Jun 15 21:00:15 2010 @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/lldb-private-log.h" +#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Log.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamString.h" @@ -29,6 +30,7 @@ #include "lldb/Target/ThreadPlanStepOverRange.h" #include "lldb/Target/ThreadPlanRunToAddress.h" #include "lldb/Target/ThreadPlanStepUntil.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -292,14 +294,25 @@ case eStopReasonBreakpoint: { bool no_details = true; - s->PutCString ("breakpoint "); + s->PutCString ("breakpoint"); if (m_thread) { BreakpointSiteSP bp_site_sp = m_thread->GetProcess().GetBreakpointSiteList().FindByID(m_details.breakpoint.bp_site_id); if (bp_site_sp) { - bp_site_sp->GetDescription(s, lldb::eDescriptionLevelBrief); - no_details = false; + // Only report the breakpoint locations that actually caused this hit - some of them may + // have options that would have caused us not to stop here... + uint32_t num_locations = bp_site_sp->GetNumberOfOwners(); + for (uint32_t i = 0; i < num_locations; i++) + { + BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(i); + if (bp_loc_sp->ValidForThisThread(m_thread)) + { + s->PutCString(" "); + bp_loc_sp->GetDescription(s, lldb::eDescriptionLevelBrief); + no_details = false; + } + } } } @@ -599,6 +612,27 @@ return GetCurrentPlan()->ShouldReportRun (event_ptr); } +bool +Thread::MatchesSpec (const ThreadSpec *spec) +{ + if (spec == NULL) + return true; + + if (!spec->TIDMatches(GetID())) + return false; + + if (!spec->IndexMatches(GetIndexID())) + return false; + + if (!spec->NameMatches (GetName())) + return false; + + if (!spec->QueueNameMatches (GetQueueName())) + return false; + + return true; +} + void Thread::PushPlan (ThreadPlanSP &thread_plan_sp) { @@ -990,7 +1024,7 @@ Thread::DumpThreadPlans (lldb_private::Stream *s) const { uint32_t stack_size = m_plan_stack.size(); - s->Printf ("Plan Stack: %d elements.\n", stack_size); + s->Printf ("Plan Stack for thread #%u: tid = 0x%4.4x - %d elements.\n", GetIndexID(), GetID(), stack_size); for (int i = stack_size - 1; i > 0; i--) { s->Printf ("Element %d: ", i); Modified: lldb/trunk/source/Target/ThreadPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=106078&r1=106077&r2=106078&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlan.cpp (original) +++ lldb/trunk/source/Target/ThreadPlan.cpp Tue Jun 15 21:00:15 2010 @@ -127,8 +127,8 @@ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); if (log) - log->Printf("About to resume the \"%s\" plan - state: %s - stop others: %d.", - m_name.c_str(), StateAsCString(resume_state), StopOthers()); + log->Printf("Thread #%u: tid = 0x%4.4x about to resume the \"%s\" plan - state: %s - stop others: %d.", + m_thread.GetIndexID(), m_thread.GetID(), m_name.c_str(), StateAsCString(resume_state), StopOthers()); } return true; } Added: lldb/trunk/source/Target/ThreadSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadSpec.cpp?rev=106078&view=auto ============================================================================== --- lldb/trunk/source/Target/ThreadSpec.cpp (added) +++ lldb/trunk/source/Target/ThreadSpec.cpp Tue Jun 15 21:00:15 2010 @@ -0,0 +1,58 @@ +//===-- ThreadSpec.cpp ----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lldb/Target/Thread.h" +#include "lldb/Target/ThreadSpec.h" + +using namespace lldb; +using namespace lldb_private; + +ThreadSpec::ThreadSpec() : + m_index (-1), + m_tid (LLDB_INVALID_THREAD_ID), + m_name(), + m_queue_name () +{ +} + +ThreadSpec::ThreadSpec (const ThreadSpec &rhs) : + m_index(rhs.m_index), + m_tid(rhs.m_tid), + m_name(rhs.m_name), + m_queue_name(rhs.m_queue_name) +{ +} + +const ThreadSpec & +ThreadSpec::operator=(const ThreadSpec &rhs) +{ + m_index = rhs.m_index; + m_tid = rhs.m_tid; + m_name = rhs.m_name; + m_queue_name = rhs.m_queue_name; + return *this; +} + +const char * +ThreadSpec::GetName () const +{ + if (m_name.empty()) + return NULL; + else + return m_name.c_str(); +} + +const char * +ThreadSpec::GetQueueName () const +{ + if (m_queue_name.empty()) + return NULL; + else + return m_queue_name.c_str(); +} From jmolenda at apple.com Tue Jun 15 22:27:27 2010 From: jmolenda at apple.com (Jason Molenda) Date: Tue, 15 Jun 2010 20:27:27 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> Message-ID: On Jun 15, 2010, at 2:43 PM, Chris Lattner wrote: > Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? Yeah, I can do that. I need to add the full set of DW_OP_{lit,reg,breg}{0..31} constants to include/llvm/Support/Dwarf.h and lib/Support/Dwarf.cpp at the very least. The printers over in Dwarf.cpp are a little annoying - the DW_TAG ones include the "DW_" prefix, the rest do not. It always grates one me when I see the prefix missing in program output - I have yet to see a context where the extra three characters would have killed anyone. I'm adding functions like const char * DW_ACCESS_value_to_name (uint32_t val) { static char invalid[100]; const char *llvmstr = AccessibilityString (val); if (llvmstr == NULL) { snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val); return invalid; } std::string str; if (strlen (llvmstr) < 3 || llvmstr[0] != 'D' || llvmstr[1] != 'W' || llvmstr[2] != '_') str = "DW_"; str += llvmstr; ConstString const_str (str.c_str()); return const_str.GetCString(); } to lldb's DWARFDefines.cpp to compensate. We also have a "value to englishy name" utility function that removes all prefix chars (e.g. "DW_FORM_") and changes '_'s to ' ' for printing; they're used in a few places. To reimplement those on top of the llvm printers I needed to add the modified string to lldb's const string pool and return a pointer to that. But for the simple value_to_name printers, it's a lot of extra fussing about to ensure that the strings have "DW_" at the front. In general I prefer the generated approach used for the header/printer functions in lldb -- there is a text file like /* START: [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ /* PREFIX: DW_TAG */ /* VALIDATTRIBS: DWARFv3 */ array_type 0x01 class_type 0x02 entry_point 0x03 enumeration_type 0x04 formal_parameter 0x05 imported_declaration 0x08 label 0x0a lexical_block 0x0b member 0x0d pointer_type 0x0f etc. so that only one table is maintained. A simple script emits the header file and C source file that prints the texts. In practice the contents change so rarely that it's not a big deal. OK to check in the additional constant values to llvm? I'll need to wait until Greg is back next week so he can update our llvm snapshot we're building against before I can commit the lldb changes. J From devang.patel at gmail.com Wed Jun 16 01:26:06 2010 From: devang.patel at gmail.com (Devang Patel) Date: Tue, 15 Jun 2010 23:26:06 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> Message-ID: On Tue, Jun 15, 2010 at 8:27 PM, Jason Molenda wrote: > > On Jun 15, 2010, at 2:43 PM, Chris Lattner wrote: > >> Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? > > Yeah, I can do that. ?I need to add the full set of DW_OP_{lit,reg,breg}{0..31} constants to include/llvm/Support/Dwarf.h and lib/Support/Dwarf.cpp at the very least. ?The printers over in Dwarf.cpp are a little annoying - the DW_TAG ones include the "DW_" prefix, the rest do not. ?It always grates one me when I see the prefix missing in program output - I have yet to see a context where the extra three characters would have killed anyone. ?I'm adding functions like > > const char * > DW_ACCESS_value_to_name (uint32_t val) > { > ?static char invalid[100]; > ?const char *llvmstr = AccessibilityString (val); > ?if (llvmstr == NULL) > ?{ > ? ? ?snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val); > ? ? ?return invalid; > ?} > > ?std::string str; > ?if (strlen (llvmstr) < 3 || llvmstr[0] != 'D' || llvmstr[1] != 'W' || llvmstr[2] != '_') > ? ?str = "DW_"; > ?str += llvmstr; > ?ConstString const_str (str.c_str()); > > ?return const_str.GetCString(); > } Instead of doing this, feel free to update llvm/lib/Support/Dwarf.cpp printer routines to use DW_ prefix. > to lldb's DWARFDefines.cpp to compensate. ?We also have a "value to englishy name" utility function that removes all prefix chars (e.g. "DW_FORM_") and changes '_'s to ' ' for printing; they're used in a few places. ?To reimplement those on top of the llvm printers I needed to add the modified string to lldb's const string pool and return a pointer to that. ?But for the simple value_to_name printers, it's a lot of extra fussing about to ensure that the strings have "DW_" at the front. > > > In general I prefer the generated approach used for the header/printer functions in lldb -- there is a text file like > > /* START: [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ > /* PREFIX: DW_TAG */ > /* VALIDATTRIBS: DWARFv3 */ > > array_type 0x01 > class_type 0x02 > entry_point 0x03 > enumeration_type 0x04 > formal_parameter 0x05 > imported_declaration 0x08 > label 0x0a > lexical_block 0x0b > member 0x0d > pointer_type 0x0f > > etc. so that only one table is maintained. ?A simple script emits the header file and C source file that prints the texts. ?In practice the contents change so rarely that it's not a big deal. > > > OK to check in the additional constant values to llvm? Sure, feel free to add new constants in llvm/include/llvm/Support/Dwarf.h - Devang From clattner at apple.com Wed Jun 16 01:29:56 2010 From: clattner at apple.com (Chris Lattner) Date: Tue, 15 Jun 2010 23:29:56 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> Message-ID: <3528B013-26AD-467D-B67D-892330040459@apple.com> FWIW, I agree with Devang. It would be nice to have the various dwarf constants all localized. Imagine a world where the compiler and debugger agree on purpose instead of by accident! :) -Chris On Jun 15, 2010, at 11:26 PM, Devang Patel wrote: > On Tue, Jun 15, 2010 at 8:27 PM, Jason Molenda wrote: >> >> On Jun 15, 2010, at 2:43 PM, Chris Lattner wrote: >> >>> Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? >> >> Yeah, I can do that. I need to add the full set of DW_OP_{lit,reg,breg}{0..31} constants to include/llvm/Support/Dwarf.h and lib/Support/Dwarf.cpp at the very least. The printers over in Dwarf.cpp are a little annoying - the DW_TAG ones include the "DW_" prefix, the rest do not. It always grates one me when I see the prefix missing in program output - I have yet to see a context where the extra three characters would have killed anyone. I'm adding functions like >> >> const char * >> DW_ACCESS_value_to_name (uint32_t val) >> { >> static char invalid[100]; >> const char *llvmstr = AccessibilityString (val); >> if (llvmstr == NULL) >> { >> snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val); >> return invalid; >> } >> >> std::string str; >> if (strlen (llvmstr) < 3 || llvmstr[0] != 'D' || llvmstr[1] != 'W' || llvmstr[2] != '_') >> str = "DW_"; >> str += llvmstr; >> ConstString const_str (str.c_str()); >> >> return const_str.GetCString(); >> } > > Instead of doing this, feel free to update llvm/lib/Support/Dwarf.cpp > printer routines to use DW_ prefix. > >> to lldb's DWARFDefines.cpp to compensate. We also have a "value to englishy name" utility function that removes all prefix chars (e.g. "DW_FORM_") and changes '_'s to ' ' for printing; they're used in a few places. To reimplement those on top of the llvm printers I needed to add the modified string to lldb's const string pool and return a pointer to that. But for the simple value_to_name printers, it's a lot of extra fussing about to ensure that the strings have "DW_" at the front. >> >> >> In general I prefer the generated approach used for the header/printer functions in lldb -- there is a text file like >> >> /* START: [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ >> /* PREFIX: DW_TAG */ >> /* VALIDATTRIBS: DWARFv3 */ >> >> array_type 0x01 >> class_type 0x02 >> entry_point 0x03 >> enumeration_type 0x04 >> formal_parameter 0x05 >> imported_declaration 0x08 >> label 0x0a >> lexical_block 0x0b >> member 0x0d >> pointer_type 0x0f >> >> etc. so that only one table is maintained. A simple script emits the header file and C source file that prints the texts. In practice the contents change so rarely that it's not a big deal. >> >> >> OK to check in the additional constant values to llvm? > > Sure, feel free to add new constants in llvm/include/llvm/Support/Dwarf.h > > - > Devang From jason at molenda.com Wed Jun 16 01:39:21 2010 From: jason at molenda.com (Jason Molenda) Date: Tue, 15 Jun 2010 23:39:21 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: <3528B013-26AD-467D-B67D-892330040459@apple.com> References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> <3528B013-26AD-467D-B67D-892330040459@apple.com> Message-ID: OK I'll look over the use of the printers in llvm tomorrow and make sure we don't get double DW_'s anywhere. ;) Thanks, J On Jun 15, 2010, at 11:29 PM, Chris Lattner wrote: > FWIW, I agree with Devang. It would be nice to have the various dwarf constants all localized. Imagine a world where the compiler and debugger agree on purpose instead of by accident! :) > > -Chris > > > On Jun 15, 2010, at 11:26 PM, Devang Patel wrote: > >> On Tue, Jun 15, 2010 at 8:27 PM, Jason Molenda wrote: >>> >>> On Jun 15, 2010, at 2:43 PM, Chris Lattner wrote: >>> >>>> Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? >>> >>> Yeah, I can do that. I need to add the full set of DW_OP_{lit,reg,breg}{0..31} constants to include/llvm/Support/Dwarf.h and lib/Support/Dwarf.cpp at the very least. The printers over in Dwarf.cpp are a little annoying - the DW_TAG ones include the "DW_" prefix, the rest do not. It always grates one me when I see the prefix missing in program output - I have yet to see a context where the extra three characters would have killed anyone. I'm adding functions like >>> >>> const char * >>> DW_ACCESS_value_to_name (uint32_t val) >>> { >>> static char invalid[100]; >>> const char *llvmstr = AccessibilityString (val); >>> if (llvmstr == NULL) >>> { >>> snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val); >>> return invalid; >>> } >>> >>> std::string str; >>> if (strlen (llvmstr) < 3 || llvmstr[0] != 'D' || llvmstr[1] != 'W' || llvmstr[2] != '_') >>> str = "DW_"; >>> str += llvmstr; >>> ConstString const_str (str.c_str()); >>> >>> return const_str.GetCString(); >>> } >> >> Instead of doing this, feel free to update llvm/lib/Support/Dwarf.cpp >> printer routines to use DW_ prefix. >> >>> to lldb's DWARFDefines.cpp to compensate. We also have a "value to englishy name" utility function that removes all prefix chars (e.g. "DW_FORM_") and changes '_'s to ' ' for printing; they're used in a few places. To reimplement those on top of the llvm printers I needed to add the modified string to lldb's const string pool and return a pointer to that. But for the simple value_to_name printers, it's a lot of extra fussing about to ensure that the strings have "DW_" at the front. >>> >>> >>> In general I prefer the generated approach used for the header/printer functions in lldb -- there is a text file like >>> >>> /* START: [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ >>> /* PREFIX: DW_TAG */ >>> /* VALIDATTRIBS: DWARFv3 */ >>> >>> array_type 0x01 >>> class_type 0x02 >>> entry_point 0x03 >>> enumeration_type 0x04 >>> formal_parameter 0x05 >>> imported_declaration 0x08 >>> label 0x0a >>> lexical_block 0x0b >>> member 0x0d >>> pointer_type 0x0f >>> >>> etc. so that only one table is maintained. A simple script emits the header file and C source file that prints the texts. In practice the contents change so rarely that it's not a big deal. >>> >>> >>> OK to check in the additional constant values to llvm? >> >> Sure, feel free to add new constants in llvm/include/llvm/Support/Dwarf.h >> >> - >> Devang > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From gclayton at apple.com Wed Jun 16 11:18:55 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 16 Jun 2010 09:18:55 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> Message-ID: <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> We will need to use the scoped timers to make sure that performance doesn't degrade on MacOSX. File size, I don't much care about, but I do care about performance. And the last time I checked the performance, there was a 3x performance difference (qsort being 3x faster than std::sort (with gcc 4.2)). Symbols tables are high up on the list when it comes to things we need to keep fast. Greg Clayton On Jun 15, 2010, at 3:25 PM, Owen Anderson wrote: > Ping? > > On Jun 11, 2010, at 2:40 PM, Owen Anderson wrote: > >> OK, so I did some measurement on this issue, using optimized (-Os) builds of LLDB, without debug symbols, targeting x86-64. >> >> When using qsort_r, Symtab.o is 43KB. >> When using std::sort, Symtab.o is 46KB. >> A 7% increase in file size on a single file. >> >> The qsort_r version of LLDB.framework is 32,840,512 bytes. >> The std::sort version of LLDB.framework is 32,840,937 bytes. >> A 0.001% increase in file size of the overall library. :-) >> >> Interestingly, it appears that those extra symbols get coalesced with ones already present (presumably in the LLVM libraries), so it doesn't actually add much at all to the resulting library. >> >> --Owen >> >> On Jun 11, 2010, at 2:03 PM, Jason Molenda wrote: >> >>> Please back this change out Owen, until you've addressed the point Greg made here - >>> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000039.html >>> >>> J >>> >>> On Jun 11, 2010, at 1:52 PM, Owen Anderson wrote: >>> >>>> Author: resistor >>>> Date: Fri Jun 11 15:52:57 2010 >>>> New Revision: 105834 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=105834&view=rev >>>> Log: >>>> Replace qsort_r with std::sort. This gets rid of a lot of portability >>>> ickiness, and is cleaner to boot. >>>> >>>> I'm fairly confident that I converted the comparator over properly, >>>> and what testing I could figure out how to run seemed to pass, but it >>>> would be great if someone in the know could check behind me. >>>> >>>> Modified: >>>> lldb/trunk/include/lldb/Symbol/Symtab.h >>>> lldb/trunk/source/Symbol/Symtab.cpp >>>> >>>> Modified: lldb/trunk/include/lldb/Symbol/Symtab.h >>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=105834&r1=105833&r2=105834&view=diff >>>> ============================================================================== >>>> --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) >>>> +++ lldb/trunk/include/lldb/Symbol/Symtab.h Fri Jun 11 15:52:57 2010 >>>> @@ -59,8 +59,6 @@ >>>> typedef collection::iterator iterator; >>>> typedef collection::const_iterator const_iterator; >>>> >>>> - static int CompareSymbolValueByIndex (void *thunk, const void *a, const void *b); >>>> - static int CompareSymbolValueByIndexLinux (const void *a, const void *b, void *thunk); >>>> void InitNameIndexes (); >>>> void InitAddressIndexes (); >>>> >>>> >>>> Modified: lldb/trunk/source/Symbol/Symtab.cpp >>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=105834&r1=105833&r2=105834&view=diff >>>> ============================================================================== >>>> --- lldb/trunk/source/Symbol/Symtab.cpp (original) >>>> +++ lldb/trunk/source/Symbol/Symtab.cpp Fri Jun 11 15:52:57 2010 >>>> @@ -214,46 +214,36 @@ >>>> const Symbol *symbols; >>>> }; >>>> >>>> -int >>>> -Symtab::CompareSymbolValueByIndex (void *thunk, const void *a, const void *b) >>>> -{ >>>> - const Symbol *symbols = (const Symbol *)thunk; >>>> - uint32_t index_a = *((uint32_t *) a); >>>> - uint32_t index_b = *((uint32_t *) b); >>>> - >>>> - addr_t value_a; >>>> - addr_t value_b; >>>> - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) >>>> - { >>>> - value_a = symbols[index_a].GetValue ().GetOffset(); >>>> - value_b = symbols[index_b].GetValue ().GetOffset(); >>>> - } >>>> - else >>>> - { >>>> - value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>> - value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>> - } >>>> - >>>> - if (value_a == value_b) >>>> - { >>>> - // The if the values are equal, use the original symbol user ID >>>> - lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>> - lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>> - if (uid_a < uid_b) >>>> - return -1; >>>> - if (uid_a > uid_b) >>>> - return 1; >>>> - return 0; >>>> - } >>>> - else if (value_a < value_b) >>>> - return -1; >>>> - >>>> - return 1; >>>> -} >>>> +namespace { >>>> + struct SymbolIndexComparator { >>>> + const std::vector& symbols; >>>> + SymbolIndexComparator(const std::vector& s) : symbols(s) { } >>>> + bool operator()(uint32_t index_a, uint32_t index_b) { >>>> + addr_t value_a; >>>> + addr_t value_b; >>>> + if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { >>>> + value_a = symbols[index_a].GetValue ().GetOffset(); >>>> + value_b = symbols[index_b].GetValue ().GetOffset(); >>>> + } else { >>>> + value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>> + value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>> + } >>>> >>>> -int Symtab::CompareSymbolValueByIndexLinux(const void* a, const void* b, void* thunk) >>>> -{ >>>> - return CompareSymbolValueByIndex(thunk, a, b); >>>> + if (value_a == value_b) { >>>> + // The if the values are equal, use the original symbol user ID >>>> + lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>> + lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>> + if (uid_a < uid_b) >>>> + return true; >>>> + if (uid_a > uid_b) >>>> + return false; >>>> + return false; >>>> + } else if (value_a < value_b) >>>> + return true; >>>> + >>>> + return false; >>>> + } >>>> + }; >>>> } >>>> >>>> void >>>> @@ -263,13 +253,8 @@ >>>> if (indexes.size() <= 1) >>>> return; >>>> >>>> - // Sort the indexes in place using qsort >>>> - // FIXME: (WRONGDEFINE) Need a better define for this! >>>> -#ifdef __APPLE__ >>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex); >>>> -#else >>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), CompareSymbolValueByIndexLinux, (void *)&m_symbols[0]); >>>> -#endif >>>> + // Sort the indexes in place using std::sort >>>> + std::sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); >>>> >>>> // Remove any duplicates if requested >>>> if (remove_duplicates) >>>> >>>> >>>> _______________________________________________ >>>> lldb-commits mailing list >>>> lldb-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >>> >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From resistor at mac.com Wed Jun 16 11:21:02 2010 From: resistor at mac.com (Owen Anderson) Date: Wed, 16 Jun 2010 09:21:02 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> Message-ID: <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> Do you have a test I can use to measure this? --Owen On Jun 16, 2010, at 9:18 AM, Greg Clayton wrote: > We will need to use the scoped timers to make sure that performance doesn't degrade on MacOSX. File size, I don't much care about, but I do care about performance. And the last time I checked the performance, there was a 3x performance difference (qsort being 3x faster than std::sort (with gcc 4.2)). Symbols tables are high up on the list when it comes to things we need to keep fast. > > Greg Clayton > > > On Jun 15, 2010, at 3:25 PM, Owen Anderson wrote: > >> Ping? >> >> On Jun 11, 2010, at 2:40 PM, Owen Anderson wrote: >> >>> OK, so I did some measurement on this issue, using optimized (-Os) builds of LLDB, without debug symbols, targeting x86-64. >>> >>> When using qsort_r, Symtab.o is 43KB. >>> When using std::sort, Symtab.o is 46KB. >>> A 7% increase in file size on a single file. >>> >>> The qsort_r version of LLDB.framework is 32,840,512 bytes. >>> The std::sort version of LLDB.framework is 32,840,937 bytes. >>> A 0.001% increase in file size of the overall library. :-) >>> >>> Interestingly, it appears that those extra symbols get coalesced with ones already present (presumably in the LLVM libraries), so it doesn't actually add much at all to the resulting library. >>> >>> --Owen >>> >>> On Jun 11, 2010, at 2:03 PM, Jason Molenda wrote: >>> >>>> Please back this change out Owen, until you've addressed the point Greg made here - >>>> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000039.html >>>> >>>> J >>>> >>>> On Jun 11, 2010, at 1:52 PM, Owen Anderson wrote: >>>> >>>>> Author: resistor >>>>> Date: Fri Jun 11 15:52:57 2010 >>>>> New Revision: 105834 >>>>> >>>>> URL: http://llvm.org/viewvc/llvm-project?rev=105834&view=rev >>>>> Log: >>>>> Replace qsort_r with std::sort. This gets rid of a lot of portability >>>>> ickiness, and is cleaner to boot. >>>>> >>>>> I'm fairly confident that I converted the comparator over properly, >>>>> and what testing I could figure out how to run seemed to pass, but it >>>>> would be great if someone in the know could check behind me. >>>>> >>>>> Modified: >>>>> lldb/trunk/include/lldb/Symbol/Symtab.h >>>>> lldb/trunk/source/Symbol/Symtab.cpp >>>>> >>>>> Modified: lldb/trunk/include/lldb/Symbol/Symtab.h >>>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=105834&r1=105833&r2=105834&view=diff >>>>> ============================================================================== >>>>> --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) >>>>> +++ lldb/trunk/include/lldb/Symbol/Symtab.h Fri Jun 11 15:52:57 2010 >>>>> @@ -59,8 +59,6 @@ >>>>> typedef collection::iterator iterator; >>>>> typedef collection::const_iterator const_iterator; >>>>> >>>>> - static int CompareSymbolValueByIndex (void *thunk, const void *a, const void *b); >>>>> - static int CompareSymbolValueByIndexLinux (const void *a, const void *b, void *thunk); >>>>> void InitNameIndexes (); >>>>> void InitAddressIndexes (); >>>>> >>>>> >>>>> Modified: lldb/trunk/source/Symbol/Symtab.cpp >>>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=105834&r1=105833&r2=105834&view=diff >>>>> ============================================================================== >>>>> --- lldb/trunk/source/Symbol/Symtab.cpp (original) >>>>> +++ lldb/trunk/source/Symbol/Symtab.cpp Fri Jun 11 15:52:57 2010 >>>>> @@ -214,46 +214,36 @@ >>>>> const Symbol *symbols; >>>>> }; >>>>> >>>>> -int >>>>> -Symtab::CompareSymbolValueByIndex (void *thunk, const void *a, const void *b) >>>>> -{ >>>>> - const Symbol *symbols = (const Symbol *)thunk; >>>>> - uint32_t index_a = *((uint32_t *) a); >>>>> - uint32_t index_b = *((uint32_t *) b); >>>>> - >>>>> - addr_t value_a; >>>>> - addr_t value_b; >>>>> - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) >>>>> - { >>>>> - value_a = symbols[index_a].GetValue ().GetOffset(); >>>>> - value_b = symbols[index_b].GetValue ().GetOffset(); >>>>> - } >>>>> - else >>>>> - { >>>>> - value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>>> - value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>>> - } >>>>> - >>>>> - if (value_a == value_b) >>>>> - { >>>>> - // The if the values are equal, use the original symbol user ID >>>>> - lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>>> - lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>>> - if (uid_a < uid_b) >>>>> - return -1; >>>>> - if (uid_a > uid_b) >>>>> - return 1; >>>>> - return 0; >>>>> - } >>>>> - else if (value_a < value_b) >>>>> - return -1; >>>>> - >>>>> - return 1; >>>>> -} >>>>> +namespace { >>>>> + struct SymbolIndexComparator { >>>>> + const std::vector& symbols; >>>>> + SymbolIndexComparator(const std::vector& s) : symbols(s) { } >>>>> + bool operator()(uint32_t index_a, uint32_t index_b) { >>>>> + addr_t value_a; >>>>> + addr_t value_b; >>>>> + if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { >>>>> + value_a = symbols[index_a].GetValue ().GetOffset(); >>>>> + value_b = symbols[index_b].GetValue ().GetOffset(); >>>>> + } else { >>>>> + value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>>> + value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>>> + } >>>>> >>>>> -int Symtab::CompareSymbolValueByIndexLinux(const void* a, const void* b, void* thunk) >>>>> -{ >>>>> - return CompareSymbolValueByIndex(thunk, a, b); >>>>> + if (value_a == value_b) { >>>>> + // The if the values are equal, use the original symbol user ID >>>>> + lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>>> + lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>>> + if (uid_a < uid_b) >>>>> + return true; >>>>> + if (uid_a > uid_b) >>>>> + return false; >>>>> + return false; >>>>> + } else if (value_a < value_b) >>>>> + return true; >>>>> + >>>>> + return false; >>>>> + } >>>>> + }; >>>>> } >>>>> >>>>> void >>>>> @@ -263,13 +253,8 @@ >>>>> if (indexes.size() <= 1) >>>>> return; >>>>> >>>>> - // Sort the indexes in place using qsort >>>>> - // FIXME: (WRONGDEFINE) Need a better define for this! >>>>> -#ifdef __APPLE__ >>>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex); >>>>> -#else >>>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), CompareSymbolValueByIndexLinux, (void *)&m_symbols[0]); >>>>> -#endif >>>>> + // Sort the indexes in place using std::sort >>>>> + std::sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); >>>>> >>>>> // Remove any duplicates if requested >>>>> if (remove_duplicates) >>>>> >>>>> >>>>> _______________________________________________ >>>>> lldb-commits mailing list >>>>> lldb-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >>>> >>> >>> _______________________________________________ >>> lldb-commits mailing list >>> lldb-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > From gclayton at apple.com Wed Jun 16 11:23:24 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 16 Jun 2010 09:23:24 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> <3528B013-26AD-467D-B67D-892330040459@apple.com> Message-ID: <8854E4DB-3296-40A7-B3D8-8E3E7FED8616@apple.com> Why not have a default parameter that has a prefix value that defaults to "DW_". To answer Jason's "I have yet to see where an extra 3 characters..." comment: when you dump a very large DWARF file they tend to matter. Dumping WebCore and having an extra "DW_" in front of everything increases the size of the output by quite a bit... On Jun 15, 2010, at 11:39 PM, Jason Molenda wrote: > OK I'll look over the use of the printers in llvm tomorrow and make sure we don't get double DW_'s anywhere. ;) > > Thanks, > > J > > On Jun 15, 2010, at 11:29 PM, Chris Lattner wrote: > >> FWIW, I agree with Devang. It would be nice to have the various dwarf constants all localized. Imagine a world where the compiler and debugger agree on purpose instead of by accident! :) >> >> -Chris >> >> >> On Jun 15, 2010, at 11:26 PM, Devang Patel wrote: >> >>> On Tue, Jun 15, 2010 at 8:27 PM, Jason Molenda wrote: >>>> >>>> On Jun 15, 2010, at 2:43 PM, Chris Lattner wrote: >>>> >>>>> Can Core/dwarf.h use (and extend) llvm/include/llvm/Support/Dwarf.h instead of duplicating much of it? >>>> >>>> Yeah, I can do that. I need to add the full set of DW_OP_{lit,reg,breg}{0..31} constants to include/llvm/Support/Dwarf.h and lib/Support/Dwarf.cpp at the very least. The printers over in Dwarf.cpp are a little annoying - the DW_TAG ones include the "DW_" prefix, the rest do not. It always grates one me when I see the prefix missing in program output - I have yet to see a context where the extra three characters would have killed anyone. I'm adding functions like >>>> >>>> const char * >>>> DW_ACCESS_value_to_name (uint32_t val) >>>> { >>>> static char invalid[100]; >>>> const char *llvmstr = AccessibilityString (val); >>>> if (llvmstr == NULL) >>>> { >>>> snprintf (invalid, sizeof (invalid), "Unknown DW_ACCESS constant: 0x%x", val); >>>> return invalid; >>>> } >>>> >>>> std::string str; >>>> if (strlen (llvmstr) < 3 || llvmstr[0] != 'D' || llvmstr[1] != 'W' || llvmstr[2] != '_') >>>> str = "DW_"; >>>> str += llvmstr; >>>> ConstString const_str (str.c_str()); >>>> >>>> return const_str.GetCString(); >>>> } >>> >>> Instead of doing this, feel free to update llvm/lib/Support/Dwarf.cpp >>> printer routines to use DW_ prefix. >>> >>>> to lldb's DWARFDefines.cpp to compensate. We also have a "value to englishy name" utility function that removes all prefix chars (e.g. "DW_FORM_") and changes '_'s to ' ' for printing; they're used in a few places. To reimplement those on top of the llvm printers I needed to add the modified string to lldb's const string pool and return a pointer to that. But for the simple value_to_name printers, it's a lot of extra fussing about to ensure that the strings have "DW_" at the front. >>>> >>>> >>>> In general I prefer the generated approach used for the header/printer functions in lldb -- there is a text file like >>>> >>>> /* START: [7.5.4] Figure 16 "Tag Encodings" (pp. 125-127) in DWARFv3 draft 8 */ >>>> /* PREFIX: DW_TAG */ >>>> /* VALIDATTRIBS: DWARFv3 */ >>>> >>>> array_type 0x01 >>>> class_type 0x02 >>>> entry_point 0x03 >>>> enumeration_type 0x04 >>>> formal_parameter 0x05 >>>> imported_declaration 0x08 >>>> label 0x0a >>>> lexical_block 0x0b >>>> member 0x0d >>>> pointer_type 0x0f >>>> >>>> etc. so that only one table is maintained. A simple script emits the header file and C source file that prints the texts. In practice the contents change so rarely that it's not a big deal. >>>> >>>> >>>> OK to check in the additional constant values to llvm? >>> >>> Sure, feel free to add new constants in llvm/include/llvm/Support/Dwarf.h >>> >>> - >>> Devang >> >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From gclayton at apple.com Wed Jun 16 11:27:57 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 16 Jun 2010 09:27:57 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> Message-ID: <21A3FC4A-4AC5-4155-A3A1-7BC6B2468F1B@apple.com> We start with "Sketch" from the /Developer/Expamples. It loads 91 shared libraries right off the bat, and if you then type: (lldb) log timers enable (lldb) breakpoint set --name main (lldb) log timers disable All of the symbol tables will be pulled in, and it will dump the timing information. You will first need to add a scoped timer to the top of: Symtab::SortSymbolIndexesByValue() The easiest way is: Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); Then you should see an entry in the timer dump for Symtab::SortSymbolIndexesByValue when the "log timers disable" is run with a total time. On Jun 16, 2010, at 9:21 AM, Owen Anderson wrote: > Do you have a test I can use to measure this? > > --Owen > > On Jun 16, 2010, at 9:18 AM, Greg Clayton wrote: > >> We will need to use the scoped timers to make sure that performance doesn't degrade on MacOSX. File size, I don't much care about, but I do care about performance. And the last time I checked the performance, there was a 3x performance difference (qsort being 3x faster than std::sort (with gcc 4.2)). Symbols tables are high up on the list when it comes to things we need to keep fast. >> >> Greg Clayton >> >> >> On Jun 15, 2010, at 3:25 PM, Owen Anderson wrote: >> >>> Ping? >>> >>> On Jun 11, 2010, at 2:40 PM, Owen Anderson wrote: >>> >>>> OK, so I did some measurement on this issue, using optimized (-Os) builds of LLDB, without debug symbols, targeting x86-64. >>>> >>>> When using qsort_r, Symtab.o is 43KB. >>>> When using std::sort, Symtab.o is 46KB. >>>> A 7% increase in file size on a single file. >>>> >>>> The qsort_r version of LLDB.framework is 32,840,512 bytes. >>>> The std::sort version of LLDB.framework is 32,840,937 bytes. >>>> A 0.001% increase in file size of the overall library. :-) >>>> >>>> Interestingly, it appears that those extra symbols get coalesced with ones already present (presumably in the LLVM libraries), so it doesn't actually add much at all to the resulting library. >>>> >>>> --Owen >>>> >>>> On Jun 11, 2010, at 2:03 PM, Jason Molenda wrote: >>>> >>>>> Please back this change out Owen, until you've addressed the point Greg made here - >>>>> http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000039.html >>>>> >>>>> J >>>>> >>>>> On Jun 11, 2010, at 1:52 PM, Owen Anderson wrote: >>>>> >>>>>> Author: resistor >>>>>> Date: Fri Jun 11 15:52:57 2010 >>>>>> New Revision: 105834 >>>>>> >>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=105834&view=rev >>>>>> Log: >>>>>> Replace qsort_r with std::sort. This gets rid of a lot of portability >>>>>> ickiness, and is cleaner to boot. >>>>>> >>>>>> I'm fairly confident that I converted the comparator over properly, >>>>>> and what testing I could figure out how to run seemed to pass, but it >>>>>> would be great if someone in the know could check behind me. >>>>>> >>>>>> Modified: >>>>>> lldb/trunk/include/lldb/Symbol/Symtab.h >>>>>> lldb/trunk/source/Symbol/Symtab.cpp >>>>>> >>>>>> Modified: lldb/trunk/include/lldb/Symbol/Symtab.h >>>>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=105834&r1=105833&r2=105834&view=diff >>>>>> ============================================================================== >>>>>> --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) >>>>>> +++ lldb/trunk/include/lldb/Symbol/Symtab.h Fri Jun 11 15:52:57 2010 >>>>>> @@ -59,8 +59,6 @@ >>>>>> typedef collection::iterator iterator; >>>>>> typedef collection::const_iterator const_iterator; >>>>>> >>>>>> - static int CompareSymbolValueByIndex (void *thunk, const void *a, const void *b); >>>>>> - static int CompareSymbolValueByIndexLinux (const void *a, const void *b, void *thunk); >>>>>> void InitNameIndexes (); >>>>>> void InitAddressIndexes (); >>>>>> >>>>>> >>>>>> Modified: lldb/trunk/source/Symbol/Symtab.cpp >>>>>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=105834&r1=105833&r2=105834&view=diff >>>>>> ============================================================================== >>>>>> --- lldb/trunk/source/Symbol/Symtab.cpp (original) >>>>>> +++ lldb/trunk/source/Symbol/Symtab.cpp Fri Jun 11 15:52:57 2010 >>>>>> @@ -214,46 +214,36 @@ >>>>>> const Symbol *symbols; >>>>>> }; >>>>>> >>>>>> -int >>>>>> -Symtab::CompareSymbolValueByIndex (void *thunk, const void *a, const void *b) >>>>>> -{ >>>>>> - const Symbol *symbols = (const Symbol *)thunk; >>>>>> - uint32_t index_a = *((uint32_t *) a); >>>>>> - uint32_t index_b = *((uint32_t *) b); >>>>>> - >>>>>> - addr_t value_a; >>>>>> - addr_t value_b; >>>>>> - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) >>>>>> - { >>>>>> - value_a = symbols[index_a].GetValue ().GetOffset(); >>>>>> - value_b = symbols[index_b].GetValue ().GetOffset(); >>>>>> - } >>>>>> - else >>>>>> - { >>>>>> - value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>>>> - value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>>>> - } >>>>>> - >>>>>> - if (value_a == value_b) >>>>>> - { >>>>>> - // The if the values are equal, use the original symbol user ID >>>>>> - lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>>>> - lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>>>> - if (uid_a < uid_b) >>>>>> - return -1; >>>>>> - if (uid_a > uid_b) >>>>>> - return 1; >>>>>> - return 0; >>>>>> - } >>>>>> - else if (value_a < value_b) >>>>>> - return -1; >>>>>> - >>>>>> - return 1; >>>>>> -} >>>>>> +namespace { >>>>>> + struct SymbolIndexComparator { >>>>>> + const std::vector& symbols; >>>>>> + SymbolIndexComparator(const std::vector& s) : symbols(s) { } >>>>>> + bool operator()(uint32_t index_a, uint32_t index_b) { >>>>>> + addr_t value_a; >>>>>> + addr_t value_b; >>>>>> + if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { >>>>>> + value_a = symbols[index_a].GetValue ().GetOffset(); >>>>>> + value_b = symbols[index_b].GetValue ().GetOffset(); >>>>>> + } else { >>>>>> + value_a = symbols[index_a].GetValue ().GetFileAddress(); >>>>>> + value_b = symbols[index_b].GetValue ().GetFileAddress(); >>>>>> + } >>>>>> >>>>>> -int Symtab::CompareSymbolValueByIndexLinux(const void* a, const void* b, void* thunk) >>>>>> -{ >>>>>> - return CompareSymbolValueByIndex(thunk, a, b); >>>>>> + if (value_a == value_b) { >>>>>> + // The if the values are equal, use the original symbol user ID >>>>>> + lldb::user_id_t uid_a = symbols[index_a].GetID(); >>>>>> + lldb::user_id_t uid_b = symbols[index_b].GetID(); >>>>>> + if (uid_a < uid_b) >>>>>> + return true; >>>>>> + if (uid_a > uid_b) >>>>>> + return false; >>>>>> + return false; >>>>>> + } else if (value_a < value_b) >>>>>> + return true; >>>>>> + >>>>>> + return false; >>>>>> + } >>>>>> + }; >>>>>> } >>>>>> >>>>>> void >>>>>> @@ -263,13 +253,8 @@ >>>>>> if (indexes.size() <= 1) >>>>>> return; >>>>>> >>>>>> - // Sort the indexes in place using qsort >>>>>> - // FIXME: (WRONGDEFINE) Need a better define for this! >>>>>> -#ifdef __APPLE__ >>>>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex); >>>>>> -#else >>>>>> - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), CompareSymbolValueByIndexLinux, (void *)&m_symbols[0]); >>>>>> -#endif >>>>>> + // Sort the indexes in place using std::sort >>>>>> + std::sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); >>>>>> >>>>>> // Remove any duplicates if requested >>>>>> if (remove_duplicates) >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> lldb-commits mailing list >>>>>> lldb-commits at cs.uiuc.edu >>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >>>>> >>>> >>>> _______________________________________________ >>>> lldb-commits mailing list >>>> lldb-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >>> >>> _______________________________________________ >>> lldb-commits mailing list >>> lldb-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20100616/22afa8ba/attachment-0001.html From resistor at mac.com Wed Jun 16 12:04:03 2010 From: resistor at mac.com (Owen Anderson) Date: Wed, 16 Jun 2010 10:04:03 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <21A3FC4A-4AC5-4155-A3A1-7BC6B2468F1B@apple.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> <21A3FC4A-4AC5-4155-A3A1-7BC6B2468F1B@apple.com> Message-ID: <63B73668-D646-4269-886D-F999445FAB7C@mac.com> OK, I just performed these measurements on 64-bit 10.6, with both -Os and -O3 builds of lldb. In both cases, std::sort was on the order of 50% slower than qsort_r: -Os -O3 std::sort 0.118s 0.103s qsort_r 0.077s 0.078s However, here's the interesting part: std::stable_sort 0.051s 0.048s So, it looks like the symbol tables are already mostly sorted, and a simple insertion sort is able to "complete" the sort quickly. FWIW, this would also be a good place to apply TimSort or some other heuristic sort. --Owen On Jun 16, 2010, at 9:27 AM, Greg Clayton wrote: > We start with "Sketch" from the /Developer/Expamples. It loads 91 shared libraries right off the bat, and if you then type: > > (lldb) log timers enable > (lldb) breakpoint set --name main > (lldb) log timers disable > > All of the symbol tables will be pulled in, and it will dump the timing information. > > You will first need to add a scoped timer to the top of: > > Symtab::SortSymbolIndexesByValue() > > The easiest way is: > > Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); > > Then you should see an entry in the timer dump for Symtab::SortSymbolIndexesByValue when the "log timers disable" is run with a total time. > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20100616/d3c7a7f6/attachment.html From gclayton at apple.com Wed Jun 16 12:19:02 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 16 Jun 2010 10:19:02 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <63B73668-D646-4269-886D-F999445FAB7C@mac.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> <21A3FC4A-4AC5-4155-A3A1-7BC6B2468F1B@apple.com> <63B73668-D646-4269-886D-F999445FAB7C@mac.com> Message-ID: Great news. Try testing this same stuff after a "purge" (clear the file caches). The "purge" is not a great test, but it gives you a bit of an idea of how things would perform if nothing was in the file cache... If things turn out the same as before, feel free to checkin the std::stable_sort fix. Greg Clayton On Jun 16, 2010, at 10:04 AM, Owen Anderson wrote: > OK, I just performed these measurements on 64-bit 10.6, with both -Os and -O3 builds of lldb. In both cases, std::sort was on the order of 50% slower than qsort_r: > > -Os -O3 > std::sort 0.118s 0.103s > qsort_r 0.077s 0.078s > > However, here's the interesting part: > > std::stable_sort 0.051s 0.048s > > So, it looks like the symbol tables are already mostly sorted, and a simple insertion sort is able to "complete" the sort quickly. FWIW, this would also be a good place to apply TimSort or some other heuristic sort. > > --Owen > > > On Jun 16, 2010, at 9:27 AM, Greg Clayton wrote: > >> We start with "Sketch" from the /Developer/Expamples. It loads 91 shared libraries right off the bat, and if you then type: >> >> (lldb) log timers enable >> (lldb) breakpoint set --name main >> (lldb) log timers disable >> >> All of the symbol tables will be pulled in, and it will dump the timing information. >> >> You will first need to add a scoped timer to the top of: >> >> Symtab::SortSymbolIndexesByValue() >> >> The easiest way is: >> >> Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); >> >> Then you should see an entry in the timer dump for Symtab::SortSymbolIndexesByValue when the "log timers disable" is run with a total time. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20100616/9e9cccfe/attachment.html From resistor at mac.com Wed Jun 16 12:22:14 2010 From: resistor at mac.com (Owen Anderson) Date: Wed, 16 Jun 2010 10:22:14 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> <21A3FC4A-4AC5-4155-A3A1-7BC6B2468F1B@apple.com> <63B73668-D646-4269-886D-F999445FAB7C@mac.com> Message-ID: <48F50D02-C5D6-4D04-9296-4685D472C7E3@mac.com> Assuming you meant "purge" at the command line, I still measure 0.052s for -Os with std::stable_sort. If there's nothing else you want me to test, I'll go ahead and commit it with that. --Owen On Jun 16, 2010, at 10:19 AM, Greg Clayton wrote: > Great news. Try testing this same stuff after a "purge" (clear the file caches). The "purge" is not a great test, but it gives you a bit of an idea of how things would perform if nothing was in the file cache... > > If things turn out the same as before, feel free to checkin the std::stable_sort fix. > > Greg Clayton > > On Jun 16, 2010, at 10:04 AM, Owen Anderson wrote: > >> OK, I just performed these measurements on 64-bit 10.6, with both -Os and -O3 builds of lldb. In both cases, std::sort was on the order of 50% slower than qsort_r: >> >> -Os -O3 >> std::sort 0.118s 0.103s >> qsort_r 0.077s 0.078s >> >> However, here's the interesting part: >> >> std::stable_sort 0.051s 0.048s >> >> So, it looks like the symbol tables are already mostly sorted, and a simple insertion sort is able to "complete" the sort quickly. FWIW, this would also be a good place to apply TimSort or some other heuristic sort. >> >> --Owen >> >> >> On Jun 16, 2010, at 9:27 AM, Greg Clayton wrote: >> >>> We start with "Sketch" from the /Developer/Expamples. It loads 91 shared libraries right off the bat, and if you then type: >>> >>> (lldb) log timers enable >>> (lldb) breakpoint set --name main >>> (lldb) log timers disable >>> >>> All of the symbol tables will be pulled in, and it will dump the timing information. >>> >>> You will first need to add a scoped timer to the top of: >>> >>> Symtab::SortSymbolIndexesByValue() >>> >>> The easiest way is: >>> >>> Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); >>> >>> Then you should see an entry in the timer dump for Symtab::SortSymbolIndexesByValue when the "log timers disable" is run with a total time. >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20100616/9e327f18/attachment.html From resistor at mac.com Wed Jun 16 12:34:06 2010 From: resistor at mac.com (Owen Anderson) Date: Wed, 16 Jun 2010 17:34:06 -0000 Subject: [Lldb-commits] [lldb] r106116 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp Message-ID: <20100616173406.259E92A6C12C@llvm.org> Author: resistor Date: Wed Jun 16 12:34:05 2010 New Revision: 106116 URL: http://llvm.org/viewvc/llvm-project?rev=106116&view=rev Log: Switch from qsort_r to std::stable_sort for a performance win and improved portability. Modified: lldb/trunk/include/lldb/Symbol/Symtab.h lldb/trunk/source/Symbol/Symtab.cpp Modified: lldb/trunk/include/lldb/Symbol/Symtab.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=106116&r1=106115&r2=106116&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/Symtab.h (original) +++ lldb/trunk/include/lldb/Symbol/Symtab.h Wed Jun 16 12:34:05 2010 @@ -59,8 +59,6 @@ typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; - static int CompareSymbolValueByIndex (void *thunk, const void *a, const void *b); - static int CompareSymbolValueByIndexLinux (const void *a, const void *b, void *thunk); void InitNameIndexes (); void InitAddressIndexes (); Modified: lldb/trunk/source/Symbol/Symtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=106116&r1=106115&r2=106116&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Symtab.cpp (original) +++ lldb/trunk/source/Symbol/Symtab.cpp Wed Jun 16 12:34:05 2010 @@ -214,62 +214,48 @@ const Symbol *symbols; }; -int -Symtab::CompareSymbolValueByIndex (void *thunk, const void *a, const void *b) -{ - const Symbol *symbols = (const Symbol *)thunk; - uint32_t index_a = *((uint32_t *) a); - uint32_t index_b = *((uint32_t *) b); - - addr_t value_a; - addr_t value_b; - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) - { - value_a = symbols[index_a].GetValue ().GetOffset(); - value_b = symbols[index_b].GetValue ().GetOffset(); - } - else - { - value_a = symbols[index_a].GetValue ().GetFileAddress(); - value_b = symbols[index_b].GetValue ().GetFileAddress(); - } - - if (value_a == value_b) - { - // The if the values are equal, use the original symbol user ID - lldb::user_id_t uid_a = symbols[index_a].GetID(); - lldb::user_id_t uid_b = symbols[index_b].GetID(); - if (uid_a < uid_b) - return -1; - if (uid_a > uid_b) - return 1; - return 0; - } - else if (value_a < value_b) - return -1; - - return 1; -} +namespace { + struct SymbolIndexComparator { + const std::vector& symbols; + SymbolIndexComparator(const std::vector& s) : symbols(s) { } + bool operator()(uint32_t index_a, uint32_t index_b) { + addr_t value_a; + addr_t value_b; + if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { + value_a = symbols[index_a].GetValue ().GetOffset(); + value_b = symbols[index_b].GetValue ().GetOffset(); + } else { + value_a = symbols[index_a].GetValue ().GetFileAddress(); + value_b = symbols[index_b].GetValue ().GetFileAddress(); + } -int Symtab::CompareSymbolValueByIndexLinux(const void* a, const void* b, void* thunk) -{ - return CompareSymbolValueByIndex(thunk, a, b); + if (value_a == value_b) { + // The if the values are equal, use the original symbol user ID + lldb::user_id_t uid_a = symbols[index_a].GetID(); + lldb::user_id_t uid_b = symbols[index_b].GetID(); + if (uid_a < uid_b) + return true; + if (uid_a > uid_b) + return false; + return false; + } else if (value_a < value_b) + return true; + + return false; + } + }; } void Symtab::SortSymbolIndexesByValue (std::vector& indexes, bool remove_duplicates) const { + Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); // No need to sort if we have zero or one items... if (indexes.size() <= 1) return; - // Sort the indexes in place using qsort - // FIXME: (WRONGDEFINE) Need a better define for this! -#ifdef __APPLE__ - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), (void *)&m_symbols[0], Symtab::CompareSymbolValueByIndex); -#else - ::qsort_r (&indexes[0], indexes.size(), sizeof(uint32_t), CompareSymbolValueByIndexLinux, (void *)&m_symbols[0]); -#endif + // Sort the indexes in place using std::sort + std::stable_sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); // Remove any duplicates if requested if (remove_duplicates) From jingham at apple.com Wed Jun 16 12:41:53 2010 From: jingham at apple.com (Jim Ingham) Date: Wed, 16 Jun 2010 10:41:53 -0700 Subject: [Lldb-commits] [lldb] r105834 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <48F50D02-C5D6-4D04-9296-4685D472C7E3@mac.com> References: <20100611205257.B3B8D2A6C12C@llvm.org> <23DB182B-8E1E-431F-8EEF-9FB49F9E4218@molenda.com> <209EF5DD-9FE9-4A1D-B7DF-0AF924273295@mac.com> <883F8E1F-AC7E-45AD-95CA-640A582F3278@mac.com> <71BCE8DF-EC5B-4D8A-8FFC-5B5035B0D001@apple.com> <74795706-06D8-4DE7-B0E5-51ACF66FA45B@mac.com> <21A3FC4A-4AC5-4155-A3A1-7BC6B2468F1B@apple.com> <63B73668-D646-4269-886D-F999445FAB7C@mac.com> <48F50D02-C5D6-4D04-9296-4685D472C7E3@mac.com> Message-ID: Very cool, thanks! Jim On Jun 16, 2010, at 10:22 AM, Owen Anderson wrote: > Assuming you meant "purge" at the command line, I still measure 0.052s for -Os with std::stable_sort. If there's nothing else you want me to test, I'll go ahead and commit it with that. > > --Owen > > On Jun 16, 2010, at 10:19 AM, Greg Clayton wrote: > >> Great news. Try testing this same stuff after a "purge" (clear the file caches). The "purge" is not a great test, but it gives you a bit of an idea of how things would perform if nothing was in the file cache... >> >> If things turn out the same as before, feel free to checkin the std::stable_sort fix. >> >> Greg Clayton >> >> On Jun 16, 2010, at 10:04 AM, Owen Anderson wrote: >> >>> OK, I just performed these measurements on 64-bit 10.6, with both -Os and -O3 builds of lldb. In both cases, std::sort was on the order of 50% slower than qsort_r: >>> >>> -Os -O3 >>> std::sort 0.118s 0.103s >>> qsort_r 0.077s 0.078s >>> >>> However, here's the interesting part: >>> >>> std::stable_sort 0.051s 0.048s >>> >>> So, it looks like the symbol tables are already mostly sorted, and a simple insertion sort is able to "complete" the sort quickly. FWIW, this would also be a good place to apply TimSort or some other heuristic sort. >>> >>> --Owen >>> >>> >>> On Jun 16, 2010, at 9:27 AM, Greg Clayton wrote: >>> >>>> We start with "Sketch" from the /Developer/Expamples. It loads 91 shared libraries right off the bat, and if you then type: >>>> >>>> (lldb) log timers enable >>>> (lldb) breakpoint set --name main >>>> (lldb) log timers disable >>>> >>>> All of the symbol tables will be pulled in, and it will dump the timing information. >>>> >>>> You will first need to add a scoped timer to the top of: >>>> >>>> Symtab::SortSymbolIndexesByValue() >>>> >>>> The easiest way is: >>>> >>>> Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); >>>> >>>> Then you should see an entry in the timer dump for Symtab::SortSymbolIndexesByValue when the "log timers disable" is run with a total time. >>>> >>> >>> >> > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From ctice at apple.com Wed Jun 16 14:26:52 2010 From: ctice at apple.com (Caroline Tice) Date: Wed, 16 Jun 2010 19:26:52 -0000 Subject: [Lldb-commits] [lldb] r106132 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj scripts/Python/build-swig-Python.sh scripts/Python/finish-swig-Python-LLDB.sh scripts/build-swig-wrapper-classes.sh scripts/finish-swig-wrapper-classes.sh Message-ID: <20100616192653.032AE2A6C12C@llvm.org> Author: ctice Date: Wed Jun 16 14:26:52 2010 New Revision: 106132 URL: http://llvm.org/viewvc/llvm-project?rev=106132&view=rev Log: Parameterize the shell scripts for creating and copying the python and other script files around, so they can be run from outside Xcode. Also, check the current OS, and only try to use the framework structure stuff on Darwin systems. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/scripts/Python/build-swig-Python.sh lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh lldb/trunk/scripts/build-swig-wrapper-classes.sh lldb/trunk/scripts/finish-swig-wrapper-classes.sh Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106132&r1=106131&r2=106132&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Wed Jun 16 14:26:52 2010 @@ -2337,15 +2337,13 @@ files = ( ); inputPaths = ( - "$(SRCROOT)/scripts/lldb.swig", - "$(SRCROOT)/source/LLDBWrapPython.cpp", ); name = "Build swig wrapper classes"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "sh $SRCROOT/scripts/build-swig-wrapper-classes.sh\n"; + shellScript = "sh $SRCROOT/scripts/build-swig-wrapper-classes.sh $SRCROOT $TARGET_BUILD_DIR $CONFIGURATION_BUILD_DIR \"\"\n"; }; 9A19ACE2116563A700E0D453 /* Finish swig wrapper classes (lldb) */ = { isa = PBXShellScriptBuildPhase; @@ -2365,7 +2363,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "sh $SRCROOT/scripts/finish-swig-wrapper-classes.sh"; + shellScript = "sh $SRCROOT/scripts/finish-swig-wrapper-classes.sh $SRCROOT $TARGET_BUILD_DIR $CONFIGURATION_BUILD_DIR \"\""; }; /* End PBXShellScriptBuildPhase section */ Modified: lldb/trunk/scripts/Python/build-swig-Python.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=106132&r1=106131&r2=106132&view=diff ============================================================================== --- lldb/trunk/scripts/Python/build-swig-Python.sh (original) +++ lldb/trunk/scripts/Python/build-swig-Python.sh Wed Jun 16 14:26:52 2010 @@ -2,8 +2,24 @@ # build-swig-Python.sh +# SRC_ROOT is the root of the lldb source tree. +# TARGET_DIR is where the lldb framework/shared library gets put. +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# put the lldb.py file it was generated from running SWIG. +# PREFIX is the root directory used to determine where third-party modules +# for scripting languages should be installed. +# debug_flag (optional) determines whether or not this script outputs +# additional information when running. + +SRC_ROOT=$1 +TARGET_DIR=$2 +CONFIG_BUILD_DIR=$3 +PYTHON_INSTALL_DIR=$4 +debug_flag=$5 + +swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp +swig_input_file=${SRC_ROOT}/scripts/lldb.swig -debug_flag=$1 if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] then @@ -13,33 +29,33 @@ fi -HEADER_FILES="${SRCROOT}/include/lldb/lldb-types.h"\ -" ${SRCROOT}/include/lldb/API/SBAddress.h"\ -" ${SRCROOT}/include/lldb/API/SBBlock.h"\ -" ${SRCROOT}/include/lldb/API/SBBreakpoint.h"\ -" ${SRCROOT}/include/lldb/API/SBBreakpointLocation.h"\ -" ${SRCROOT}/include/lldb/API/SBBroadcaster.h"\ -" ${SRCROOT}/include/lldb/API/SBCommandContext.h"\ -" ${SRCROOT}/include/lldb/API/SBCommandInterpreter.h"\ -" ${SRCROOT}/include/lldb/API/SBCommandReturnObject.h"\ -" ${SRCROOT}/include/lldb/API/SBCompileUnit.h"\ -" ${SRCROOT}/include/lldb/API/SBDebugger.h"\ -" ${SRCROOT}/include/lldb/API/SBError.h"\ -" ${SRCROOT}/include/lldb/API/SBEvent.h"\ -" ${SRCROOT}/include/lldb/API/SBFrame.h"\ -" ${SRCROOT}/include/lldb/API/SBFunction.h"\ -" ${SRCROOT}/include/lldb/API/SBLineEntry.h"\ -" ${SRCROOT}/include/lldb/API/SBListener.h"\ -" ${SRCROOT}/include/lldb/API/SBModule.h"\ -" ${SRCROOT}/include/lldb/API/SBProcess.h"\ -" ${SRCROOT}/include/lldb/API/SBSourceManager.h"\ -" ${SRCROOT}/include/lldb/API/SBStringList.h"\ -" ${SRCROOT}/include/lldb/API/SBSymbol.h"\ -" ${SRCROOT}/include/lldb/API/SBSymbolContext.h"\ -" ${SRCROOT}/include/lldb/API/SBTarget.h"\ -" ${SRCROOT}/include/lldb/API/SBThread.h"\ -" ${SRCROOT}/include/lldb/API/SBType.h"\ -" ${SRCROOT}/include/lldb/API/SBValue.h" +HEADER_FILES="${SRC_ROOT}/include/lldb/lldb-types.h"\ +" ${SRC_ROOT}/include/lldb/API/SBAddress.h"\ +" ${SRC_ROOT}/include/lldb/API/SBBlock.h"\ +" ${SRC_ROOT}/include/lldb/API/SBBreakpoint.h"\ +" ${SRC_ROOT}/include/lldb/API/SBBreakpointLocation.h"\ +" ${SRC_ROOT}/include/lldb/API/SBBroadcaster.h"\ +" ${SRC_ROOT}/include/lldb/API/SBCommandContext.h"\ +" ${SRC_ROOT}/include/lldb/API/SBCommandInterpreter.h"\ +" ${SRC_ROOT}/include/lldb/API/SBCommandReturnObject.h"\ +" ${SRC_ROOT}/include/lldb/API/SBCompileUnit.h"\ +" ${SRC_ROOT}/include/lldb/API/SBDebugger.h"\ +" ${SRC_ROOT}/include/lldb/API/SBError.h"\ +" ${SRC_ROOT}/include/lldb/API/SBEvent.h"\ +" ${SRC_ROOT}/include/lldb/API/SBFrame.h"\ +" ${SRC_ROOT}/include/lldb/API/SBFunction.h"\ +" ${SRC_ROOT}/include/lldb/API/SBLineEntry.h"\ +" ${SRC_ROOT}/include/lldb/API/SBListener.h"\ +" ${SRC_ROOT}/include/lldb/API/SBModule.h"\ +" ${SRC_ROOT}/include/lldb/API/SBProcess.h"\ +" ${SRC_ROOT}/include/lldb/API/SBSourceManager.h"\ +" ${SRC_ROOT}/include/lldb/API/SBStringList.h"\ +" ${SRC_ROOT}/include/lldb/API/SBSymbol.h"\ +" ${SRC_ROOT}/include/lldb/API/SBSymbolContext.h"\ +" ${SRC_ROOT}/include/lldb/API/SBTarget.h"\ +" ${SRC_ROOT}/include/lldb/API/SBThread.h"\ +" ${SRC_ROOT}/include/lldb/API/SBType.h"\ +" ${SRC_ROOT}/include/lldb/API/SBValue.h" if [ $Debug == 1 ] @@ -50,7 +66,6 @@ NeedToUpdate=0 -swig_output_file=${SCRIPT_INPUT_FILE_1} if [ ! -f $swig_output_file ] then @@ -77,7 +92,16 @@ done fi -framework_python_dir="${CONFIGURATION_BUILD_DIR}/LLDB.framework/Versions/A/Resources/Python" +os_name=`uname -s` +python_version=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` + +if [ "$os_name" == "Darwin" ] +then + framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python" +else + framework_python_dir="${PYTHON_INSTALL_DIR}/python${python_version}" +fi + if [ ! -L "${framework_python_dir}/_lldb.so" ] then @@ -101,27 +125,5 @@ # Build the SWIG C++ wrapper file for Python. -swig -c++ -shadow -python -I"${SRCROOT}/include" -I./. -outdir "${CONFIGURATION_BUILD_DIR}" -o "${SCRIPT_INPUT_FILE_1}" "${SCRIPT_INPUT_FILE_0}" - -# Edit the C++ wrapper file that SWIG generated for Python. There are two -# global string replacements needed, which the following script file takes -# care of. It reads in 'LLDBWrapPython.cpp' and generates -# 'LLDBWrapPython.cpp.edited'. - -# The need for this has been eliminated by fixing the namespace qualifiers on return types. -# Leaving this here for now, just in case... -# -#if [ -f "${SRCROOT}/scripts/Python/edit-swig-python-wrapper-file.py" ] -#then -# python "${SRCROOT}/scripts/Python/edit-swig-python-wrapper-file.py" -#fi - -# -# Now that we've got a C++ file we're happy with (hopefully), rename the -# edited file and move it to the appropriate places. -# +swig -c++ -shadow -python -I"${SRC_ROOT}/include" -I./. -outdir "${CONFIG_BUILD_DIR}" -o "${swig_output_file}" "${swig_input_file}" -if [ -f "${SCRIPT_INPUT_FILE_1}.edited" ] -then - mv "${SCRIPT_INPUT_FILE_1}.edited" "${SCRIPT_INPUT_FILE_1}" -fi Modified: lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh?rev=106132&r1=106131&r2=106132&view=diff ============================================================================== --- lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh (original) +++ lldb/trunk/scripts/Python/finish-swig-Python-LLDB.sh Wed Jun 16 14:26:52 2010 @@ -3,43 +3,167 @@ # finish-swig-Python.sh # # For the Python script interpreter (external to liblldb) to be able to import -# and use the lldb module, there must be a "_lldb.so" in the framework -# resources directory. Here we make a symlink called "_lldb.so" that just -# points to the executable in the LLDB.framework and copy over the needed -# .py files. +# and use the lldb module, there must be two files, lldb.py and _lldb.so, that +# it can find. lldb.py is generated by SWIG at the same time it generates the +# C++ file. _lldb.so is actually a symlink file that points to the +# LLDB shared library/framework. +# +# The Python script interpreter needs to be able to automatically find +# these two files. On Darwin systems it searches in the LLDB.framework, as +# well as in all the normal Python search paths. On non-Darwin systems +# these files will need to be put someplace where Python will find them. +# +# This shell script creates the _lldb.so symlink in the appropriate place, +# and copies the lldb.py (and embedded_interpreter.py) file to the correct +# directory. +# + +# SRC_ROOT is the root of the lldb source tree. +# TARGET_DIR is where the lldb framework/shared library gets put. +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# put the lldb.py file it was generated from running SWIG. +# PYTHON_INSTALL_DIR is where non-Darwin systems want to put the .py and .so +# files so that Python can find them automatically. +# debug_flag (optional) determines whether or not this script outputs +# additional information when running. + +SRC_ROOT=$1 +TARGET_DIR=$2 +CONFIG_BUILD_DIR=$3 +PYTHON_INSTALL_DIR=$4 +debug_flag=$5 -if [ ! -d "${TARGET_BUILD_DIR}/LLDB.framework" ] +if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] then - echo "Error: Unable to find LLDB.framework" >&2 - exit 1 + Debug=1 +else + Debug=0 +fi + +OS_NAME=`uname -s` +PYTHON_VERSION=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` + + +if [ $Debug == 1 ] +then + echo "The current OS is $OS_NAME" + echo "The Python version is $PYTHON_VERSION" +fi + +# +# Determine where to put the files. + +if [ ${OS_NAME} == "Darwin" ] +then + # We are on a Darwin system, so all the lldb Python files can go + # into the LLDB.framework/Resources/Python subdirectory. + + if [ ! -d "${TARGET_DIR}/LLDB.framework" ] + then + echo "Error: Unable to find LLDB.framework" >&2 + exit 1 + else + if [ $Debug == 1 ] + then + echo "Found ${TARGET_DIR}/LLDB.framework." + fi + fi + + # Make the Python directory in the framework if it doesn't already exist + + framework_python_dir="${TARGET_DIR}/LLDB.framework/Resources/Python" +else + # We are on a non-Darwin system, so use the PYTHON_INSTALL_DIR argument, + # and append the python version directory to the end of it. Depending on + # the system other stuff may need to be put here as well. + + framework_python_dir="${PYTHON_INSTALL_DIR}/python${PYTHON_VERSION}" +fi + +# +# Look for the directory in which to put the Python files; if it does not +# already exist, attempt to make it. +# + +if [ $Debug == 1 ] +then + echo "Python files will be put in ${framework_python_dir}" fi -# Make the Python directory down in the framework if it doesn't already exist -framework_python_dir="${TARGET_BUILD_DIR}/LLDB.framework/Versions/A/Resources/Python" if [ ! -d "${framework_python_dir}" ] then - mkdir -p "${framework_python_dir}" + if [ $Debug == 1 ] + then + echo "Making directory ${framework_python_dir}" + fi + mkdir -p "${framework_python_dir}" +else + if [ $Debug == 1 ] + then + echo "${framework_python_dir} already exists." + fi fi -# Make the symlink that the script bridge for Python will need in the Python -# framework directory +if [ ! -d "${framework_python_dir}" ] +then + echo "Error: Unable to find or create ${framework_python_dir}" >&2 + exit 1 +fi + +# Make the symlink that the script bridge for Python will need in the +# Python framework directory + if [ ! -L "${framework_python_dir}/_lldb.so" ] then - cd "${framework_python_dir}" + if [ $Debug == 1 ] + then + echo "Creating symlink for _lldb.so" + fi + if [ ${OS_NAME} == "Darwin" ] + then + cd "${framework_python_dir}" ln -s "../../LLDB" _lldb.so + else + cd "${TARGET_DIR}" + ln -s "./LLDB" _lldb.so + fi +else + if [ $Debug == 1 ] + then + echo "${framework_python_dir}/_lldb.so already exists." + fi fi # Copy the python module (lldb.py) that was generated by SWIG # over to the framework Python directory -if [ -f "${CONFIGURATION_BUILD_DIR}/lldb.py" ] +if [ -f "${CONFIG_BUILD_DIR}/lldb.py" ] then - cp "${CONFIGURATION_BUILD_DIR}/lldb.py" "${framework_python_dir}" + if [ $Debug == 1 ] + then + echo "Copying lldb.py to ${framework_python_dir}" + fi + cp "${CONFIG_BUILD_DIR}/lldb.py" "${framework_python_dir}" +else + if [ $Debug == 1 ] + then + echo "Unable to find ${CONFIG_BUILD_DIR}/lldb.py" + fi fi # Copy the embedded interpreter script over to the framework Python directory -if [ -f "${SRCROOT}/source/Interpreter/embedded_interpreter.py" ] +if [ -f "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" ] then - cp "${SRCROOT}/source/Interpreter/embedded_interpreter.py" "${framework_python_dir}" + if [ $Debug == 1 ] + then + echo "Copying embedded_interpreter.py to ${framework_python_dir}" + fi + cp "${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" "${framework_python_dir}" +else + if [ $Debug == 1 ] + then + echo "Unable to find ${SRC_ROOT}/source/Interpreter/embedded_interpreter.py" + fi fi exit 0 + Modified: lldb/trunk/scripts/build-swig-wrapper-classes.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/build-swig-wrapper-classes.sh?rev=106132&r1=106131&r2=106132&view=diff ============================================================================== --- lldb/trunk/scripts/build-swig-wrapper-classes.sh (original) +++ lldb/trunk/scripts/build-swig-wrapper-classes.sh Wed Jun 16 14:26:52 2010 @@ -10,7 +10,27 @@ # the scripting language. In some cases the file generated by SWIG may # need some tweaking before it is completely ready to use. -debug_flag=$1 +# Below are the arguments/parameters that this script takes (and passes along +# to all the language-specific build scripts that it calls): +# +# SRC_ROOT is the root of the lldb source tree. +# TARGET_DIR is where the lldb framework/shared library gets put. +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# put the lldb.py file it was generated from running SWIG. +# PREFIX is where non-Darwin systems want to put the .py and .so +# files so that Python can find them automatically. +# debug_flag (optional) determines whether or not this script outputs +# additional information when running. + +SRC_ROOT=$1 +TARGET_DIR=$2 +CONFIG_BUILD_DIR=$3 +PREFIX=$4 +debug_flag=$5 + +# +# Check to see if we are in debug-mode or not. +# if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] then @@ -23,7 +43,7 @@ # Verify that 'lldb.swig' exists. # -if [ ! -f ${SRCROOT}/scripts/lldb.swig ] +if [ ! -f ${SRC_ROOT}/scripts/lldb.swig ] then echo Error: unable to find file 'lldb.swig' >&2 exit 1 @@ -42,7 +62,7 @@ # change. languages="Python" -cwd=${SRCROOT}/scripts +cwd=${SRC_ROOT}/scripts for curlang in $languages do @@ -78,7 +98,7 @@ echo "Executing $curlang build script..." fi - ./build-swig-${curlang}.sh + ./build-swig-${curlang}.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" fi fi done Modified: lldb/trunk/scripts/finish-swig-wrapper-classes.sh URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finish-swig-wrapper-classes.sh?rev=106132&r1=106131&r2=106132&view=diff ============================================================================== --- lldb/trunk/scripts/finish-swig-wrapper-classes.sh (original) +++ lldb/trunk/scripts/finish-swig-wrapper-classes.sh Wed Jun 16 14:26:52 2010 @@ -13,7 +13,20 @@ # language stuff fully functional. Any such post-processing is handled through # the shell scripts called here. -debug_flag=$1 +# SRC_ROOT is the root of the lldb source tree. +# TARGET_DIR is where the lldb framework/shared library gets put. +# CONFIG_BUILD_DIR is where the build-swig-Python-LLDB.sh shell script +# put the lldb.py file it generated from running SWIG. +# PREFIX is the root directory used to determine where third-party modules +# for scripting languages should be installed. +# debug_flag (optional) determines whether or not this script outputs +# additional information when running. + +SRC_ROOT=$1 +TARGET_DIR=$2 +CONFIG_BUILD_DIR=$3 +PREFIX=$4 +debug_flag=$5 if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] then @@ -31,7 +44,7 @@ # change. languages="Python" -cwd=${SRCROOT}/scripts +cwd=${SRC_ROOT}/scripts for curlang in $languages do @@ -53,17 +66,18 @@ cd $cwd/$curlang - filename="./finish-swig-${curlang}-${TARGET_NAME}.sh" + filename="./finish-swig-${curlang}-LLDB.sh" if [ -f $filename ] then if [ $Debug == 1 ] then - echo "Found $curlang post-processing script for ${TARGET_NAME}" + echo "Found $curlang post-processing script for LLDB" echo "Executing $curlang post-processing script..." fi - ./finish-swig-${curlang}-${TARGET_NAME}.sh + + ./finish-swig-${curlang}-LLDB.sh $SRC_ROOT $TARGET_DIR $CONFIG_BUILD_DIR "${PREFIX}" "${debug_flag}" fi fi done From jason at molenda.com Wed Jun 16 14:29:32 2010 From: jason at molenda.com (Jason Molenda) Date: Wed, 16 Jun 2010 12:29:32 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: <8854E4DB-3296-40A7-B3D8-8E3E7FED8616@apple.com> References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> <3528B013-26AD-467D-B67D-892330040459@apple.com> <8854E4DB-3296-40A7-B3D8-8E3E7FED8616@apple.com> Message-ID: On Jun 16, 2010, at 9:23 AM, Greg Clayton wrote: > To answer Jason's "I have yet to see where an extra 3 characters..." comment: when you dump a very large DWARF file they tend to matter. Dumping WebCore and having an extra "DW_" in front of everything increases the size of the output by quite a bit... I assume you're talking about dwarfdump here. It's true, dumping the dwarf for WebKit (a very large web browser library) is a lot of output - I started dwarfdump running on the x86_64 side of the WebKit dSYM and it hasn't finished yet. I've got 740MB of text output so far and adding "DW_" to the start of the names ("DW_AT_type" instead of "AT_type") would add about 30MB or around 4%. I would argue that this "DW_" eliding is premature optimization. dwarfdump has been dumping the WebKit dSYM for about an hour on my workstation with local file access for input/output and it hasn't completed yet. I redirected the output of dwarfdump to a file (instead of using the -o option) which may be to blame but the process is using around 2-3% of the CPU. Outputting 700MB of formatted text should not take nearly this much time -- either dwarfdump is reading data off the disk inefficiently or outputting it inefficiently. The drawback to not outputting "DW_" is for end users. For us, we can look at "AT_type" and say, Oh yes of course that means DW_AT_type. But for someone less familiar with DWARF who is trying to understand the format or diagnose a problem related to debug info, it's an additional hurdle they have to compensate for if they are googling for the definitions or looking through the DWARF standards document. I'd argue that eliding "DW_" does not solve the performance problems and reduces understandability for out users. It's a poor tradeoff. J From johnny.chen at apple.com Wed Jun 16 14:30:20 2010 From: johnny.chen at apple.com (Johnny Chen) Date: Wed, 16 Jun 2010 19:30:20 -0000 Subject: [Lldb-commits] [lldb] r106133 - /lldb/trunk/include/lldb/Core/Timer.h Message-ID: <20100616193020.79AA42A6C12C@llvm.org> Author: johnny Date: Wed Jun 16 14:30:20 2010 New Revision: 106133 URL: http://llvm.org/viewvc/llvm-project?rev=106133&view=rev Log: Fixed a typo in comment. Modified: lldb/trunk/include/lldb/Core/Timer.h Modified: lldb/trunk/include/lldb/Core/Timer.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Timer.h?rev=106133&r1=106132&r2=106133&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Timer.h (original) +++ lldb/trunk/include/lldb/Core/Timer.h Wed Jun 16 14:30:20 2010 @@ -23,7 +23,7 @@ /// @brief A timer class that simplifies common timing metrics. /// /// A scoped timer class that allows a variety of pthread mutex -/// objects to have a mutex locked when an Timer::Locker +/// objects to have a mutex locked when a Timer::Locker /// object is created, and unlocked when it goes out of scope or /// when the Timer::Locker::Reset(pthread_mutex_t *) /// is called. This provides an exception safe way to lock a mutex From jason at molenda.com Wed Jun 16 14:38:45 2010 From: jason at molenda.com (Jason Molenda) Date: Wed, 16 Jun 2010 12:38:45 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> <3528B013-26AD-467D-B67D-892330040459@apple.com> <8854E4DB-3296-40A7-B3D8-8E3E7FED8616@apple.com> Message-ID: On Jun 16, 2010, at 12:29 PM, Jason Molenda wrote: > > On Jun 16, 2010, at 9:23 AM, Greg Clayton wrote: > >> To answer Jason's "I have yet to see where an extra 3 characters..." comment: when you dump a very large DWARF file they tend to matter. Dumping WebCore and having an extra "DW_" in front of everything increases the size of the output by quite a bit... > > I assume you're talking about dwarfdump here. BTW I should note that I'm not arguing about how the dwarfdump on Mac OS X should behave here - only how lldb/llvm should behave. It looks silly if our debugger calls things "AT_..." while the rest of the world calls them "DW_AT_..." even if it's unambiguous. The long form is the name which everyone uses and we will conform to that. J From gclayton at apple.com Wed Jun 16 16:44:24 2010 From: gclayton at apple.com (Greg Clayton) Date: Wed, 16 Jun 2010 14:44:24 -0700 Subject: [Lldb-commits] [lldb] r106045 - /lldb/trunk/include/lldb/Core/dwarf.h In-Reply-To: References: <20100615212035.3E0EB2A6C12C@llvm.org> <3BA2987C-58F0-4C36-93BE-A89483BE94B6@apple.com> <3528B013-26AD-467D-B67D-892330040459@apple.com> <8854E4DB-3296-40A7-B3D8-8E3E7FED8616@apple.com> Message-ID: Agreed. On Jun 16, 2010, at 12:38 PM, Jason Molenda wrote: > > On Jun 16, 2010, at 12:29 PM, Jason Molenda wrote: > >> >> On Jun 16, 2010, at 9:23 AM, Greg Clayton wrote: >> >>> To answer Jason's "I have yet to see where an extra 3 characters..." comment: when you dump a very large DWARF file they tend to matter. Dumping WebCore and having an extra "DW_" in front of everything increases the size of the output by quite a bit... >> >> I assume you're talking about dwarfdump here. > > BTW I should note that I'm not arguing about how the dwarfdump on Mac OS X should behave here - only how lldb/llvm should behave. It looks silly if our debugger calls things "AT_..." while the rest of the world calls them "DW_AT_..." even if it's unambiguous. The long form is the name which everyone uses and we will conform to that. > > J From scallanan at apple.com Wed Jun 16 17:19:05 2010 From: scallanan at apple.com (Sean Callanan) Date: Wed, 16 Jun 2010 22:19:05 -0000 Subject: [Lldb-commits] [lldb] r106160 - /lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Message-ID: <20100616221905.CAD502A6C12C@llvm.org> Author: spyffe Date: Wed Jun 16 17:19:05 2010 New Revision: 106160 URL: http://llvm.org/viewvc/llvm-project?rev=106160&view=rev Log: Fixed a problem where invalid triples were being passed into the constructor for the LLVMDisassembler, resulting in asserts. Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=106160&r1=106159&r2=106160&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original) +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Wed Jun 16 17:19:05 2010 @@ -344,7 +344,7 @@ char triple[256]; if (TripleForArchSpec (arch, triple, sizeof(triple))) - return new DisassemblerLLVM(triple); + return new DisassemblerLLVM(arch); return NULL; } From scallanan at apple.com Wed Jun 16 19:32:06 2010 From: scallanan at apple.com (Sean Callanan) Date: Thu, 17 Jun 2010 00:32:06 -0000 Subject: [Lldb-commits] [lldb] r106186 - /lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Message-ID: <20100617003206.0E9AB2A6C12C@llvm.org> Author: spyffe Date: Wed Jun 16 19:32:05 2010 New Revision: 106186 URL: http://llvm.org/viewvc/llvm-project?rev=106186&view=rev Log: Unstick the -r option for the disassemble command. Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=106186&r1=106185&r2=106186&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Wed Jun 16 19:32:05 2010 @@ -108,6 +108,7 @@ m_func_name.clear(); m_start_addr = LLDB_INVALID_ADDRESS; m_end_addr = LLDB_INVALID_ADDRESS; + raw = false; } const lldb::OptionDefinition* From clattner at apple.com Wed Jun 16 19:46:28 2010 From: clattner at apple.com (Chris Lattner) Date: Wed, 16 Jun 2010 17:46:28 -0700 Subject: [Lldb-commits] [lldb] r106116 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <20100616173406.259E92A6C12C@llvm.org> References: <20100616173406.259E92A6C12C@llvm.org> Message-ID: <7051653A-ABD8-4C81-8279-5B03566F37A8@apple.com> On Jun 16, 2010, at 10:34 AM, Owen Anderson wrote: > + // Sort the indexes in place using std::sort > + std::stable_sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); Hi Owen, Please correct the comment. Also, please expand it to talk about why stable_sort is the right answer here (it's a perf win, not important for correctness). Thanks! -Chris From resistor at mac.com Wed Jun 16 19:51:12 2010 From: resistor at mac.com (Owen Anderson) Date: Thu, 17 Jun 2010 00:51:12 -0000 Subject: [Lldb-commits] [lldb] r106192 - /lldb/trunk/source/Symbol/Symtab.cpp Message-ID: <20100617005112.BDA792A6C12C@llvm.org> Author: resistor Date: Wed Jun 16 19:51:12 2010 New Revision: 106192 URL: http://llvm.org/viewvc/llvm-project?rev=106192&view=rev Log: Fix comment, per Chris' suggestion. Modified: lldb/trunk/source/Symbol/Symtab.cpp Modified: lldb/trunk/source/Symbol/Symtab.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=106192&r1=106191&r2=106192&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Symtab.cpp (original) +++ lldb/trunk/source/Symbol/Symtab.cpp Wed Jun 16 19:51:12 2010 @@ -254,7 +254,10 @@ if (indexes.size() <= 1) return; - // Sort the indexes in place using std::sort + // Sort the indexes in place using std::stable_sort. + // NOTE: The use of std::stable_sort instead of std::sort here is strictly for performance, + // not correctness. The indexes vector tends to be "close" to sorted, which the + // stable sort handles better. std::stable_sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); // Remove any duplicates if requested From resistor at mac.com Wed Jun 16 19:51:52 2010 From: resistor at mac.com (Owen Anderson) Date: Wed, 16 Jun 2010 17:51:52 -0700 Subject: [Lldb-commits] [lldb] r106116 - in /lldb/trunk: include/lldb/Symbol/Symtab.h source/Symbol/Symtab.cpp In-Reply-To: <7051653A-ABD8-4C81-8279-5B03566F37A8@apple.com> References: <20100616173406.259E92A6C12C@llvm.org> <7051653A-ABD8-4C81-8279-5B03566F37A8@apple.com> Message-ID: <2F6E15B8-0DEA-4D0D-B35D-A65DD4DE6DFA@mac.com> On Jun 16, 2010, at 5:46 PM, Chris Lattner wrote: > Please correct the comment. Also, please expand it to talk about why stable_sort is the right answer here (it's a perf win, not important for correctness). Fixed in r106192. --Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/lldb-commits/attachments/20100616/47d8575b/attachment.html From clattner at apple.com Wed Jun 16 20:07:13 2010 From: clattner at apple.com (Chris Lattner) Date: Wed, 16 Jun 2010 18:07:13 -0700 Subject: [Lldb-commits] [lldb] r106192 - /lldb/trunk/source/Symbol/Symtab.cpp In-Reply-To: <20100617005112.BDA792A6C12C@llvm.org> References: <20100617005112.BDA792A6C12C@llvm.org> Message-ID: <43789F9F-6ACB-4877-ACB2-91BD58CB92E0@apple.com> Thanks! On Jun 16, 2010, at 5:51 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Jun 16 19:51:12 2010 > New Revision: 106192 > > URL: http://llvm.org/viewvc/llvm-project?rev=106192&view=rev > Log: > Fix comment, per Chris' suggestion. > > Modified: > lldb/trunk/source/Symbol/Symtab.cpp > > Modified: lldb/trunk/source/Symbol/Symtab.cpp > URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Symtab.cpp?rev=106192&r1=106191&r2=106192&view=diff > ============================================================================== > --- lldb/trunk/source/Symbol/Symtab.cpp (original) > +++ lldb/trunk/source/Symbol/Symtab.cpp Wed Jun 16 19:51:12 2010 > @@ -254,7 +254,10 @@ > if (indexes.size() <= 1) > return; > > - // Sort the indexes in place using std::sort > + // Sort the indexes in place using std::stable_sort. > + // NOTE: The use of std::stable_sort instead of std::sort here is strictly for performance, > + // not correctness. The indexes vector tends to be "close" to sorted, which the > + // stable sort handles better. > std::stable_sort(indexes.begin(), indexes.end(), SymbolIndexComparator(m_symbols)); > > // Remove any duplicates if requested > > > _______________________________________________ > lldb-commits mailing list > lldb-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits From jingham at apple.com Thu Jun 17 19:58:52 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 18 Jun 2010 00:58:52 -0000 Subject: [Lldb-commits] [lldb] r106261 - in /lldb/trunk/source/Commands: CommandObjectBreakpoint.cpp CommandObjectBreakpoint.h Message-ID: <20100618005852.D2BC62A6C12C@llvm.org> Author: jingham Date: Thu Jun 17 19:58:52 2010 New Revision: 106261 URL: http://llvm.org/viewvc/llvm-project?rev=106261&view=rev Log: Change "breakpoint configure" to "breakpoint modify" so it doesn't collide with "breakpoint command" Change "breakpoint enable/disable" so changing a breakpoint's state doesn't also overwrite the location states. Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=106261&r1=106260&r2=106261&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Thu Jun 17 19:58:52 2010 @@ -43,6 +43,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointSet::CommandOptions //------------------------------------------------------------------------- +#pragma mark Set::CommandOptions CommandObjectBreakpointSet::CommandOptions::CommandOptions() : Options (), @@ -165,6 +166,7 @@ if (m_ignore_count == -1) error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); } + break; case 't' : { m_thread_id = Args::StringToUInt64(optarg, LLDB_INVALID_THREAD_ID, 0); @@ -217,6 +219,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointSet //------------------------------------------------------------------------- +#pragma mark Set CommandObjectBreakpointSet::CommandObjectBreakpointSet () : CommandObject ("breakpoint set", "Sets a breakpoint or set of breakpoints in the executable.", @@ -453,6 +456,7 @@ //------------------------------------------------------------------------- // CommandObjectMultiwordBreakpoint //------------------------------------------------------------------------- +#pragma mark MultiwordBreakpoint CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint (CommandInterpreter *interpreter) : CommandObjectMultiword ("breakpoint", @@ -467,14 +471,14 @@ CommandObjectSP disable_command_object (new CommandObjectBreakpointDisable ()); CommandObjectSP set_command_object (new CommandObjectBreakpointSet ()); CommandObjectSP command_command_object (new CommandObjectBreakpointCommand (interpreter)); - CommandObjectSP configure_command_object (new CommandObjectBreakpointConfigure()); + CommandObjectSP modify_command_object (new CommandObjectBreakpointModify()); + command_command_object->SetCommandName ("breakpoint command"); enable_command_object->SetCommandName("breakpoint enable"); disable_command_object->SetCommandName("breakpoint disable"); - set_command_object->SetCommandName("breakpoint set"); - command_command_object->SetCommandName ("breakpoint command"); list_command_object->SetCommandName ("breakpoint list"); - configure_command_object->SetCommandName ("breakpoint configure"); + modify_command_object->SetCommandName ("breakpoint modify"); + set_command_object->SetCommandName("breakpoint set"); status = LoadSubCommand (list_command_object, "list", interpreter); status = LoadSubCommand (enable_command_object, "enable", interpreter); @@ -482,7 +486,7 @@ status = LoadSubCommand (delete_command_object, "delete", interpreter); status = LoadSubCommand (set_command_object, "set", interpreter); status = LoadSubCommand (command_command_object, "command", interpreter); - status = LoadSubCommand (configure_command_object, "configure", interpreter); + status = LoadSubCommand (modify_command_object, "modify", interpreter); } CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint () @@ -549,6 +553,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointList::Options //------------------------------------------------------------------------- +#pragma mark List::CommandOptions CommandObjectBreakpointList::CommandOptions::CommandOptions() : Options (), @@ -626,6 +631,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointList //------------------------------------------------------------------------- +#pragma mark List CommandObjectBreakpointList::CommandObjectBreakpointList () : CommandObject ("breakpoint list", @@ -716,6 +722,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointEnable //------------------------------------------------------------------------- +#pragma mark Enable CommandObjectBreakpointEnable::CommandObjectBreakpointEnable () : CommandObject ("enable", @@ -791,22 +798,13 @@ if (location) { location->SetEnabled (true); - breakpoint->SetEnabled (true); ++loc_count; } } else { - target->EnableBreakpointByID (cur_bp_id.GetBreakpointID()); + breakpoint->SetEnabled (true); ++enable_count; - - int num_locations = breakpoint->GetNumLocations (); - for (int j = 0; j < num_locations; ++j) - { - BreakpointLocation *cur_loc = breakpoint->GetLocationAtIndex(j).get(); - if (cur_loc) - cur_loc->SetEnabled (true); - } } } } @@ -821,6 +819,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointDisable //------------------------------------------------------------------------- +#pragma mark Disable CommandObjectBreakpointDisable::CommandObjectBreakpointDisable () : CommandObject ("disable", @@ -899,16 +898,8 @@ } else { - target->DisableBreakpointByID (cur_bp_id.GetBreakpointID()); + breakpoint->SetEnabled (false); ++disable_count; - - int num_locations = breakpoint->GetNumLocations(); - for (int j = 0; j < num_locations; ++j) - { - BreakpointLocation *cur_loc = breakpoint->GetLocationAtIndex(j).get(); - if (cur_loc) - cur_loc->SetEnabled (false); - } } } } @@ -923,6 +914,7 @@ //------------------------------------------------------------------------- // CommandObjectBreakpointDelete //------------------------------------------------------------------------- +#pragma mark Delete CommandObjectBreakpointDelete::CommandObjectBreakpointDelete() : CommandObject ("breakpoint delete", @@ -1019,25 +1011,27 @@ } //------------------------------------------------------------------------- -// CommandObjectBreakpointConfigure::CommandOptions +// CommandObjectBreakpointModify::CommandOptions //------------------------------------------------------------------------- +#pragma mark Modify::CommandOptions -CommandObjectBreakpointConfigure::CommandOptions::CommandOptions() : +CommandObjectBreakpointModify::CommandOptions::CommandOptions() : Options (), m_thread_id(LLDB_INVALID_THREAD_ID), m_thread_index (-1), m_thread_name(), m_queue_name(), - m_ignore_count (-1) + m_ignore_count (-1), + m_enable_passed (false) { } -CommandObjectBreakpointConfigure::CommandOptions::~CommandOptions () +CommandObjectBreakpointModify::CommandOptions::~CommandOptions () { } lldb::OptionDefinition -CommandObjectBreakpointConfigure::CommandOptions::g_option_table[] = +CommandObjectBreakpointModify::CommandOptions::g_option_table[] = { { LLDB_OPT_SET_ALL, false, "ignore_count", 'k', required_argument, NULL, 0, NULL, "Set the number of times this breakpoint is sKipped before stopping." }, @@ -1054,29 +1048,45 @@ { LLDB_OPT_SET_ALL, false, "queue_name", 'q', required_argument, NULL, NULL, "", "The breakpoint stops only for threads in the queue whose name is given by this argument."}, + { LLDB_OPT_SET_1, false, "enable", 'e', no_argument, NULL, NULL, NULL, + "Enable the breakpoint."}, + + { LLDB_OPT_SET_2, false, "disable", 'd', no_argument, NULL, NULL, NULL, + "Disable the breakpoint."}, + + { 0, false, NULL, 0, 0, NULL, 0, NULL, NULL } }; const lldb::OptionDefinition* -CommandObjectBreakpointConfigure::CommandOptions::GetDefinitions () +CommandObjectBreakpointModify::CommandOptions::GetDefinitions () { return g_option_table; } Error -CommandObjectBreakpointConfigure::CommandOptions::SetOptionValue (int option_idx, const char *option_arg) +CommandObjectBreakpointModify::CommandOptions::SetOptionValue (int option_idx, const char *option_arg) { Error error; char short_option = (char) m_getopt_table[option_idx].val; switch (short_option) { + case 'd': + m_enable_passed = true; + m_enable_value = false; + break; + case 'e': + m_enable_passed = true; + m_enable_value = true; + break; case 'k': { m_ignore_count = Args::StringToSInt32(optarg, -1, 0); if (m_ignore_count == -1) error.SetErrorStringWithFormat ("Invalid ignore count '%s'.\n", optarg); } + break; case 't' : { m_thread_id = Args::StringToUInt64(optarg, LLDB_INVALID_THREAD_ID, 0); @@ -1107,7 +1117,7 @@ } void -CommandObjectBreakpointConfigure::CommandOptions::ResetOptionValues () +CommandObjectBreakpointModify::CommandOptions::ResetOptionValues () { Options::ResetOptionValues(); @@ -1116,30 +1126,32 @@ m_thread_index = -1; m_thread_name.clear(); m_queue_name.clear(); + m_enable_passed = false; } //------------------------------------------------------------------------- -// CommandObjectBreakpointSet +// CommandObjectBreakpointModify //------------------------------------------------------------------------- +#pragma mark Modify -CommandObjectBreakpointConfigure::CommandObjectBreakpointConfigure () : - CommandObject ("breakpoint configure", "Configures the options on a breakpoint or set of breakpoints in the executable.", - "breakpoint configure break-id [break-id ...]") +CommandObjectBreakpointModify::CommandObjectBreakpointModify () : + CommandObject ("breakpoint modify", "Modifys the options on a breakpoint or set of breakpoints in the executable.", + "breakpoint modify break-id [break-id ...]") { } -CommandObjectBreakpointConfigure::~CommandObjectBreakpointConfigure () +CommandObjectBreakpointModify::~CommandObjectBreakpointModify () { } Options * -CommandObjectBreakpointConfigure::GetOptions () +CommandObjectBreakpointModify::GetOptions () { return &m_options; } bool -CommandObjectBreakpointConfigure::Execute +CommandObjectBreakpointModify::Execute ( Args& command, CommandContext *context, @@ -1197,6 +1209,9 @@ if (m_options.m_ignore_count != -1) location->GetLocationOptions()->SetIgnoreCount(m_options.m_ignore_count); + + if (m_options.m_enable_passed) + location->SetEnabled (m_options.m_enable_value); } } else @@ -1215,6 +1230,10 @@ if (m_options.m_ignore_count != -1) bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count); + + if (m_options.m_enable_passed) + bp->SetEnabled (m_options.m_enable_value); + } } } Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=106261&r1=106260&r2=106261&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Thu Jun 17 19:58:52 2010 @@ -119,18 +119,18 @@ }; //------------------------------------------------------------------------- -// CommandObjectMultiwordBreakpointConfigure +// CommandObjectMultiwordBreakpointModify //------------------------------------------------------------------------- -class CommandObjectBreakpointConfigure : public CommandObject +class CommandObjectBreakpointModify : public CommandObject { public: - CommandObjectBreakpointConfigure (); + CommandObjectBreakpointModify (); virtual - ~CommandObjectBreakpointConfigure (); + ~CommandObjectBreakpointModify (); virtual bool Execute (Args& command, @@ -170,6 +170,8 @@ uint32_t m_thread_index; std::string m_thread_name; std::string m_queue_name; + bool m_enable_passed; + bool m_enable_value; }; From jingham at apple.com Thu Jun 17 20:00:58 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 18 Jun 2010 01:00:58 -0000 Subject: [Lldb-commits] [lldb] r106262 - in /lldb/trunk: include/lldb/Breakpoint/BreakpointOptions.h include/lldb/Target/Thread.h include/lldb/Target/ThreadSpec.h source/Breakpoint/Breakpoint.cpp source/Breakpoint/BreakpointLocation.cpp source/Breakpoint/BreakpointOptions.cpp source/Target/Thread.cpp source/Target/ThreadSpec.cpp Message-ID: <20100618010058.D7BBD2A6C12C@llvm.org> Author: jingham Date: Thu Jun 17 20:00:58 2010 New Revision: 106262 URL: http://llvm.org/viewvc/llvm-project?rev=106262&view=rev Log: Change the Breakpoint & BreakpointLocation GetDescription methods so they call the BreakpointOptions::GetDescription rather than picking bits out of the breakpoint options. Added BreakpointOptions::GetDescription to do this job. Some more mucking around to keep the breakpoint listing from getting too verbose. Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/include/lldb/Target/ThreadSpec.h lldb/trunk/source/Breakpoint/Breakpoint.cpp lldb/trunk/source/Breakpoint/BreakpointLocation.cpp lldb/trunk/source/Breakpoint/BreakpointOptions.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadSpec.cpp Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original) +++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Thu Jun 17 20:00:58 2010 @@ -39,7 +39,8 @@ BreakpointOptions(); BreakpointOptions(const BreakpointOptions& rhs); - + static BreakpointOptions * + CopyOptionsNoCallback (BreakpointOptions &rhs); //------------------------------------------------------------------ /// This constructor allows you to specify all the breakpoint options. /// @@ -142,6 +143,15 @@ void SetThreadID(lldb::tid_t thread_id); + + void + GetDescription (Stream *s, lldb::DescriptionLevel level) const; + + //------------------------------------------------------------------ + /// Returns true if the breakpoint option has a callback set. + //------------------------------------------------------------------ + bool + HasCallback(); //------------------------------------------------------------------ /// This is the default empty callback. Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Thu Jun 17 20:00:58 2010 @@ -263,6 +263,11 @@ lldb::Vote ShouldReportRun (Event *event_ptr); + // Return whether this thread matches the specification in ThreadSpec. This is a virtual + // method because at some point we may extend the thread spec with a platform specific + // dictionary of attributes, which then only the platform specific Thread implementation + // would know how to match. For now, this just calls through to the ThreadSpec's + // ThreadPassesBasicTests method. virtual bool MatchesSpec (const ThreadSpec *spec); Modified: lldb/trunk/include/lldb/Target/ThreadSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadSpec.h?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadSpec.h (original) +++ lldb/trunk/include/lldb/Target/ThreadSpec.h Thu Jun 17 20:00:58 2010 @@ -121,6 +121,15 @@ return m_queue_name == queue_name; } + bool + ThreadPassesBasicTests (Thread *thread) const; + + bool + HasSpecification () const; + + void + GetDescription (Stream *s, lldb::DescriptionLevel level) const; + protected: private: uint32_t m_index; Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original) +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Thu Jun 17 20:00:58 2010 @@ -380,28 +380,21 @@ s->Printf(" with 0 locations (Pending Breakpoint)."); } + GetOptions()->GetDescription(s, level); + if (level == lldb::eDescriptionLevelFull) { - Baton *baton = GetOptions()->GetBaton(); - if (baton) - { - s->EOL (); - s->Indent(); - baton->GetDescription(s, level); - } + s->IndentLess(); + s->EOL(); } break; case lldb::eDescriptionLevelVerbose: // Verbose mode does a debug dump of the breakpoint Dump (s); - Baton *baton = GetOptions()->GetBaton(); - if (baton) - { - s->EOL (); - s->Indent(); - baton->GetDescription(s, level); - } + s->EOL (); + s->Indent(); + GetOptions()->GetDescription(s, level); break; } @@ -420,7 +413,8 @@ } } -Breakpoint::BreakpointEventData::BreakpointEventData (Breakpoint::BreakpointEventData::EventSubType sub_type, BreakpointSP &new_breakpoint_sp) : +Breakpoint::BreakpointEventData::BreakpointEventData (Breakpoint::BreakpointEventData::EventSubType sub_type, + BreakpointSP &new_breakpoint_sp) : EventData (), m_sub_type (sub_type), m_new_breakpoint_sp (new_breakpoint_sp) Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Thu Jun 17 20:00:58 2010 @@ -109,15 +109,10 @@ bool BreakpointLocation::InvokeCallback (StoppointCallbackContext *context) { - bool owner_result; - - owner_result = m_owner.InvokeCallback (context, GetID()); - if (owner_result == false) - return false; - else if (m_options_ap.get() != NULL) + if (m_options_ap.get() != NULL && m_options_ap->HasCallback()) return m_options_ap->InvokeCallback (context, m_owner.GetID(), GetID()); - else - return true; + else + return m_owner.InvokeCallback (context, GetID()); } void @@ -166,9 +161,12 @@ BreakpointOptions * BreakpointLocation::GetLocationOptions () { + // If we make the copy we don't copy the callbacks because that is potentially + // expensive and we don't want to do that for the simple case where someone is + // just disabling the location. if (m_options_ap.get() == NULL) - m_options_ap.reset(new BreakpointOptions (*m_owner.GetOptions ())); - + m_options_ap.reset(BreakpointOptions::CopyOptionsNoCallback(*m_owner.GetOptions ())); + return m_options_ap.get(); } @@ -257,7 +255,8 @@ { if (m_bp_site_sp.get()) { - m_owner.GetTarget().GetProcessSP()->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(), GetID(), m_bp_site_sp); + m_owner.GetTarget().GetProcessSP()->RemoveOwnerFromBreakpointSite (GetBreakpoint().GetID(), + GetID(), m_bp_site_sp); m_bp_site_sp.reset(); return true; } @@ -353,29 +352,25 @@ s->Printf("resolved = %s\n", IsResolved() ? "true" : "false"); s->Indent(); - s->Printf("enabled = %s\n", IsEnabled() ? "true" : "false"); - - s->Indent(); s->Printf ("hit count = %-4u\n", GetHitCount()); if (m_options_ap.get()) { - Baton *baton = m_options_ap->GetBaton(); - if (baton) - { - s->Indent(); - baton->GetDescription (s, level); - s->EOL(); - } + s->Indent(); + m_options_ap->GetDescription (s, level); + s->EOL(); } s->IndentLess(); } else { - s->Printf(", %sresolved, %s, hit count = %u", + s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"), - (IsEnabled() ? "enabled" : "disabled"), GetHitCount()); + if (m_options_ap.get()) + { + m_options_ap->GetDescription (s, level); + } } } @@ -385,7 +380,8 @@ if (s == NULL) return; - s->Printf("BreakpointLocation %u: tid = %4.4x load addr = 0x%8.8llx state = %s type = %s breakpoint hw_index = %i hit_count = %-4u ignore_count = %-4u", + s->Printf("BreakpointLocation %u: tid = %4.4x load addr = 0x%8.8llx state = %s type = %s breakpoint " + "hw_index = %i hit_count = %-4u ignore_count = %-4u", GetID(), GetOptionsNoCopy()->GetThreadSpec()->GetTID(), (uint64_t) m_address.GetLoadAddress(m_owner.GetTarget().GetProcessSP().get()), Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original) +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Thu Jun 17 20:00:58 2010 @@ -71,6 +71,21 @@ return *this; } +BreakpointOptions * +BreakpointOptions::CopyOptionsNoCallback (BreakpointOptions &orig) +{ + BreakpointHitCallback orig_callback = orig.m_callback; + lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp; + bool orig_is_sync = orig.m_callback_is_synchronous; + + orig.ClearCallback(); + BreakpointOptions *ret_val = new BreakpointOptions(orig); + + orig.SetCallback (orig_callback, orig_callback_baton_sp, orig_is_sync); + + return ret_val; +} + //---------------------------------------------------------------------- // Destructor //---------------------------------------------------------------------- @@ -124,6 +139,12 @@ return true; } +bool +BreakpointOptions::HasCallback () +{ + return m_callback != BreakpointOptions::NullCallback; +} + //------------------------------------------------------------------ // Enabled/Ignore Count //------------------------------------------------------------------ @@ -173,10 +194,68 @@ } void +BreakpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) const +{ + + // Figure out if there are any options not at their default value, and only print + // anything if there are: + + if (m_ignore_count != 0 || !m_enabled || (GetThreadSpec() != NULL && GetThreadSpec()->HasSpecification ())) + { + if (level == lldb::eDescriptionLevelVerbose) + { + s->EOL (); + s->IndentMore(); + s->Indent(); + s->PutCString("Breakpoint Options:\n"); + s->IndentMore(); + s->Indent(); + } + else + s->PutCString(" Options: "); + + if (m_ignore_count > 0) + s->Printf("ignore: %d ", m_ignore_count); + s->Printf("%sabled ", m_enabled ? "en" : "dis"); + + if (m_thread_spec_ap.get()) + m_thread_spec_ap->GetDescription (s, level); + else if (level == eDescriptionLevelBrief) + s->PutCString ("thread spec: no "); + if (level == lldb::eDescriptionLevelFull) + { + s->IndentLess(); + s->IndentMore(); + } + } + + if (m_callback_baton_sp.get()) + { + if (level != eDescriptionLevelBrief) + s->EOL(); + m_callback_baton_sp->GetDescription (s, level); + } + else if (level == eDescriptionLevelBrief) + s->PutCString ("commands: no "); + +} + +void BreakpointOptions::CommandBaton::GetDescription (Stream *s, lldb::DescriptionLevel level) const { - s->Indent("Breakpoint commands:\n"); CommandData *data = (CommandData *)m_data; + + if (level == eDescriptionLevelBrief) + { + if (data && data->user_source.GetSize() > 0) + s->PutCString("commands: yes "); + else + s->PutCString("commands: no "); + return; + } + + s->IndentMore (); + s->Indent("Breakpoint commands:\n"); s->IndentMore (); if (data && data->user_source.GetSize() > 0) @@ -193,5 +272,6 @@ s->PutCString ("No commands.\n"); } s->IndentLess (); + s->IndentLess (); } Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Thu Jun 17 20:00:58 2010 @@ -617,20 +617,8 @@ { if (spec == NULL) return true; - - if (!spec->TIDMatches(GetID())) - return false; - if (!spec->IndexMatches(GetIndexID())) - return false; - - if (!spec->NameMatches (GetName())) - return false; - - if (!spec->QueueNameMatches (GetQueueName())) - return false; - - return true; + return spec->ThreadPassesBasicTests(this); } void Modified: lldb/trunk/source/Target/ThreadSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadSpec.cpp?rev=106262&r1=106261&r2=106262&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadSpec.cpp (original) +++ lldb/trunk/source/Target/ThreadSpec.cpp Thu Jun 17 20:00:58 2010 @@ -56,3 +56,67 @@ else return m_queue_name.c_str(); } + +bool +ThreadSpec::ThreadPassesBasicTests (Thread *thread) const +{ + + if (!HasSpecification()) + return true; + + if (!TIDMatches(thread->GetID())) + return false; + + if (!IndexMatches(thread->GetIndexID())) + return false; + + if (!NameMatches (thread->GetName())) + return false; + + if (!QueueNameMatches (thread->GetQueueName())) + return false; + + return true; + +} + +bool +ThreadSpec::HasSpecification() const +{ + return (m_index != -1 || m_tid != LLDB_INVALID_THREAD_ID || !m_name.empty() || !m_queue_name.empty()); +} +void +ThreadSpec::GetDescription (Stream *s, lldb::DescriptionLevel level) const +{ + if (!HasSpecification()) + { + if (level == eDescriptionLevelBrief) + { + s->PutCString("thread spec: no "); + } + } + else + { + if (level == eDescriptionLevelBrief) + { + s->PutCString("thread spec: yes "); + } + else + { + if (GetTID() != LLDB_INVALID_THREAD_ID) + s->Printf("tid: 0x%llx ", GetTID()); + + if (GetIndex() != -1) + s->Printf("index: %d ", GetIndex()); + + const char *name = GetName(); + if (name) + s->Printf ("thread name: \"%s\" ", name); + + const char *queue_name = GetQueueName(); + if (queue_name) + s->Printf ("queue name: \"%s\" ", queue_name); + } + + } +} From jingham at apple.com Thu Jun 17 20:23:09 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 18 Jun 2010 01:23:09 -0000 Subject: [Lldb-commits] [lldb] r106265 - in /lldb/trunk: lldb.xcodeproj/project.pbxproj source/Commands/CommandObjectProcess.cpp source/Commands/CommandObjectStatus.cpp source/Commands/CommandObjectStatus.h source/Interpreter/CommandInterpreter.cpp tools/driver/Driver.cpp Message-ID: <20100618012309.42BF72A6C12C@llvm.org> Author: jingham Date: Thu Jun 17 20:23:09 2010 New Revision: 106265 URL: http://llvm.org/viewvc/llvm-project?rev=106265&view=rev Log: Move the "status" command to "process status" since that's where it belongs. Also make it print "running" if invoked when the current process is running. Removed: lldb/trunk/source/Commands/CommandObjectStatus.cpp lldb/trunk/source/Commands/CommandObjectStatus.h Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/Commands/CommandObjectProcess.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/tools/driver/Driver.cpp Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106265&r1=106264&r2=106265&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Jun 17 20:23:09 2010 @@ -97,7 +97,6 @@ 26D5B08711B07550009A862E /* CommandObjectShow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */; }; 26D5B08811B07550009A862E /* CommandObjectSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */; }; 26D5B08911B07550009A862E /* CommandObjectSourceFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */; }; - 26D5B08A11B07550009A862E /* CommandObjectStatus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4410F1B84700F91463 /* CommandObjectStatus.cpp */; }; 26D5B08B11B07550009A862E /* CommandObjectSyntax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */; }; 26D5B08C11B07550009A862E /* CommandObjectThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */; }; 26D5B08D11B07550009A862E /* CommandObjectVariable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E4810F1B84700F91463 /* CommandObjectVariable.cpp */; }; @@ -617,7 +616,6 @@ 26BC7D2810F1B76300F91463 /* CommandObjectShow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectShow.h; path = source/Commands/CommandObjectShow.h; sourceTree = ""; }; 26BC7D2910F1B76300F91463 /* CommandObjectSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSource.h; path = source/Commands/CommandObjectSource.h; sourceTree = ""; }; 26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSourceFile.h; path = source/Commands/CommandObjectSourceFile.h; sourceTree = ""; }; - 26BC7D2B10F1B76300F91463 /* CommandObjectStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectStatus.h; path = source/Commands/CommandObjectStatus.h; sourceTree = ""; }; 26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectSyntax.h; path = source/Commands/CommandObjectSyntax.h; sourceTree = ""; }; 26BC7D2D10F1B76300F91463 /* CommandObjectThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectThread.h; path = source/Commands/CommandObjectThread.h; sourceTree = ""; }; 26BC7D2E10F1B76300F91463 /* CommandObjectTranslate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CommandObjectTranslate.h; path = source/Commands/CommandObjectTranslate.h; sourceTree = ""; }; @@ -740,7 +738,6 @@ 26BC7E4110F1B84700F91463 /* CommandObjectShow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectShow.cpp; path = source/Commands/CommandObjectShow.cpp; sourceTree = ""; }; 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSource.cpp; path = source/Commands/CommandObjectSource.cpp; sourceTree = ""; }; 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSourceFile.cpp; path = source/Commands/CommandObjectSourceFile.cpp; sourceTree = ""; }; - 26BC7E4410F1B84700F91463 /* CommandObjectStatus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectStatus.cpp; path = source/Commands/CommandObjectStatus.cpp; sourceTree = ""; }; 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectSyntax.cpp; path = source/Commands/CommandObjectSyntax.cpp; sourceTree = ""; }; 26BC7E4610F1B84700F91463 /* CommandObjectThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectThread.cpp; path = source/Commands/CommandObjectThread.cpp; sourceTree = ""; }; 26BC7E4710F1B84700F91463 /* CommandObjectTranslate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CommandObjectTranslate.cpp; path = source/Commands/CommandObjectTranslate.cpp; sourceTree = ""; }; @@ -1815,8 +1812,6 @@ 26BC7E4210F1B84700F91463 /* CommandObjectSource.cpp */, 26BC7D2A10F1B76300F91463 /* CommandObjectSourceFile.h */, 26BC7E4310F1B84700F91463 /* CommandObjectSourceFile.cpp */, - 26BC7D2B10F1B76300F91463 /* CommandObjectStatus.h */, - 26BC7E4410F1B84700F91463 /* CommandObjectStatus.cpp */, 26BC7D2C10F1B76300F91463 /* CommandObjectSyntax.h */, 26BC7E4510F1B84700F91463 /* CommandObjectSyntax.cpp */, 269416AE119A024800FF2715 /* CommandObjectTarget.h */, @@ -2409,7 +2404,6 @@ 26D5B08711B07550009A862E /* CommandObjectShow.cpp in Sources */, 26D5B08811B07550009A862E /* CommandObjectSource.cpp in Sources */, 26D5B08911B07550009A862E /* CommandObjectSourceFile.cpp in Sources */, - 26D5B08A11B07550009A862E /* CommandObjectStatus.cpp in Sources */, 26D5B08B11B07550009A862E /* CommandObjectSyntax.cpp in Sources */, 26D5B08C11B07550009A862E /* CommandObjectThread.cpp in Sources */, 26D5B08D11B07550009A862E /* CommandObjectVariable.cpp in Sources */, Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=106265&r1=106264&r2=106265&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Jun 17 20:23:09 2010 @@ -18,6 +18,7 @@ #include "lldb/Core/State.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" +#include "./CommandObjectThread.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" @@ -810,6 +811,83 @@ }; //------------------------------------------------------------------------- +// CommandObjectProcessStatus +//------------------------------------------------------------------------- +class CommandObjectProcessStatus : public CommandObject +{ +public: + CommandObjectProcessStatus () : + CommandObject ("status", + "Shows the current status and location of executing process.", + "status", + 0) + { + } + + ~CommandObjectProcessStatus() + { + } + + + bool + Execute + ( + Args& command, + CommandContext *context, + CommandInterpreter *interpreter, + CommandReturnObject &result + ) + { + StreamString &output_stream = result.GetOutputStream(); + result.SetStatus (eReturnStatusSuccessFinishNoResult); + ExecutionContext exe_ctx(context->GetExecutionContext()); + if (exe_ctx.process) + { + const StateType state = exe_ctx.process->GetState(); + if (StateIsStoppedState(state)) + { + if (state == eStateExited) + { + int exit_status = exe_ctx.process->GetExitStatus(); + const char *exit_description = exe_ctx.process->GetExitDescription(); + output_stream.Printf ("Process %d exited with status = %i (0x%8.8x) %s\n", + exe_ctx.process->GetID(), + exit_status, + exit_status, + exit_description ? exit_description : ""); + } + else + { + output_stream.Printf ("Process %d %s\n", exe_ctx.process->GetID(), StateAsCString (state)); + if (exe_ctx.thread == NULL) + exe_ctx.thread = exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get(); + if (exe_ctx.thread != NULL) + { + DisplayThreadsInfo (interpreter, &exe_ctx, result, true, true); + } + else + { + result.AppendError ("No valid thread found in current process."); + result.SetStatus (eReturnStatusFailed); + } + } + } + else + { + output_stream.Printf ("Process %d is running.\n", + exe_ctx.process->GetID()); + } + } + else + { + result.AppendError ("No current location or status available."); + result.SetStatus (eReturnStatusFailed); + } + return result.Succeeded(); + } +}; + +//------------------------------------------------------------------------- // CommandObjectMultiwordProcess //------------------------------------------------------------------------- @@ -823,6 +901,7 @@ LoadSubCommand (CommandObjectSP (new CommandObjectProcessContinue ()), "continue", interpreter); LoadSubCommand (CommandObjectSP (new CommandObjectProcessDetach ()), "detach", interpreter); LoadSubCommand (CommandObjectSP (new CommandObjectProcessSignal ()), "signal", interpreter); + LoadSubCommand (CommandObjectSP (new CommandObjectProcessStatus ()), "status", interpreter); LoadSubCommand (CommandObjectSP (new CommandObjectProcessInterrupt ()), "interrupt", interpreter); LoadSubCommand (CommandObjectSP (new CommandObjectProcessKill ()), "kill", interpreter); } Removed: lldb/trunk/source/Commands/CommandObjectStatus.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStatus.cpp?rev=106264&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectStatus.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectStatus.cpp (removed) @@ -1,97 +0,0 @@ -//===-- CommandObjectStatus.cpp ---------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "CommandObjectStatus.h" - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "CommandObjectThread.h" - -#include "lldb/Core/State.h" - -#include "lldb/Interpreter/CommandInterpreter.h" -#include "lldb/Interpreter/CommandReturnObject.h" - -#include "lldb/Target/Process.h" -#include "lldb/Target/Thread.h" - -using namespace lldb; -using namespace lldb_private; - -//------------------------------------------------------------------------- -// CommandObjectStatus -//------------------------------------------------------------------------- - -CommandObjectStatus::CommandObjectStatus () : - CommandObject ("status", - "Shows the current status and location of executing process.", - "status", - 0) -{ -} - -CommandObjectStatus::~CommandObjectStatus() -{ -} - - -bool -CommandObjectStatus::Execute -( - Args& command, - CommandContext *context, - CommandInterpreter *interpreter, - CommandReturnObject &result -) -{ - StreamString &output_stream = result.GetOutputStream(); - result.SetStatus (eReturnStatusSuccessFinishNoResult); - ExecutionContext exe_ctx(context->GetExecutionContext()); - if (exe_ctx.process) - { - const StateType state = exe_ctx.process->GetState(); - if (StateIsStoppedState(state)) - { - if (state == eStateExited) - { - int exit_status = exe_ctx.process->GetExitStatus(); - const char *exit_description = exe_ctx.process->GetExitDescription(); - output_stream.Printf ("Process %d exited with status = %i (0x%8.8x) %s\n", - exe_ctx.process->GetID(), - exit_status, - exit_status, - exit_description ? exit_description : ""); - } - else - { - output_stream.Printf ("Process %d %s\n", exe_ctx.process->GetID(), StateAsCString (state)); - if (exe_ctx.thread == NULL) - exe_ctx.thread = exe_ctx.process->GetThreadList().GetThreadAtIndex(0).get(); - if (exe_ctx.thread != NULL) - { - DisplayThreadsInfo (interpreter, &exe_ctx, result, true, true); - } - else - { - result.AppendError ("No valid thread found in current process."); - result.SetStatus (eReturnStatusFailed); - } - } - } - } - else - { - result.AppendError ("No current location or status available."); - result.SetStatus (eReturnStatusFailed); - } - return result.Succeeded(); -} - Removed: lldb/trunk/source/Commands/CommandObjectStatus.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectStatus.h?rev=106264&view=auto ============================================================================== --- lldb/trunk/source/Commands/CommandObjectStatus.h (original) +++ lldb/trunk/source/Commands/CommandObjectStatus.h (removed) @@ -1,44 +0,0 @@ -//===-- CommandObjectStatus.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_CommandObjectStatus_h_ -#define liblldb_CommandObjectStatus_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Interpreter/CommandObject.h" - -namespace lldb_private { - -//------------------------------------------------------------------------- -// CommandObjectStatus -//------------------------------------------------------------------------- - -class CommandObjectStatus : public CommandObject -{ -public: - - CommandObjectStatus (); - - ~CommandObjectStatus (); - - virtual bool - Execute (Args& command, - CommandContext *context, - CommandInterpreter *interpreter, - CommandReturnObject &result); - - -}; - -} // namespace lldb_private - -#endif // liblldb_CommandObjectStatus_h_ Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=106265&r1=106264&r2=106265&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Jun 17 20:23:09 2010 @@ -237,7 +237,6 @@ m_command_dict["source"] = CommandObjectSP (new CommandObjectSource ()); m_command_dict["source-file"] = CommandObjectSP (new CommandObjectSourceFile ()); //m_command_dict["syntax"] = CommandObjectSP (new CommandObjectSyntax ()); - m_command_dict["status"] = CommandObjectSP (new CommandObjectStatus ()); m_command_dict["target"] = CommandObjectSP (new CommandObjectMultiwordTarget (this)); m_command_dict["thread"] = CommandObjectSP (new CommandObjectMultiwordThread (this)); //m_command_dict["translate"] = CommandObjectSP (new CommandObjectTranslate ()); Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=106265&r1=106264&r2=106265&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Thu Jun 17 20:23:09 2010 @@ -775,7 +775,7 @@ break; case eStateExited: - SBDebugger::HandleCommand("status"); + SBDebugger::HandleCommand("process status"); m_io_channel_ap->RefreshPrompt(); break; @@ -794,7 +794,7 @@ else { UpdateCurrentThread (); - SBDebugger::HandleCommand("status"); + SBDebugger::HandleCommand("process status"); m_io_channel_ap->RefreshPrompt(); } break; From jingham at apple.com Thu Jun 17 20:47:08 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 18 Jun 2010 01:47:08 -0000 Subject: [Lldb-commits] [lldb] r106268 - in /lldb/trunk: include/lldb/API/SBBreakpoint.h include/lldb/API/SBBreakpointLocation.h source/API/SBBreakpoint.cpp source/API/SBBreakpointLocation.cpp Message-ID: <20100618014708.87F3F2A6C12C@llvm.org> Author: jingham Date: Thu Jun 17 20:47:08 2010 New Revision: 106268 URL: http://llvm.org/viewvc/llvm-project?rev=106268&view=rev Log: Adding setting thread specific breakpoints by name, ID, index & queue name to the SB interfaces. Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h lldb/trunk/include/lldb/API/SBBreakpointLocation.h lldb/trunk/source/API/SBBreakpoint.cpp lldb/trunk/source/API/SBBreakpointLocation.cpp Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=106268&r1=106267&r2=106268&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpoint.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpoint.h Thu Jun 17 20:47:08 2010 @@ -79,6 +79,24 @@ lldb::tid_t GetThreadID (); + + void + SetThreadIndex (uint32_t index); + + uint32_t + GetThreadIndex() const; + + void + SetThreadName (const char *thread_name); + + const char * + GetThreadName () const; + + void + SetQueueName (const char *queue_name); + + const char * + GetQueueName () const; void SetCallback (BreakpointHitCallback callback, void *baton); Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=106268&r1=106267&r2=106268&view=diff ============================================================================== --- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original) +++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Thu Jun 17 20:47:08 2010 @@ -42,10 +42,28 @@ SetIgnoreCount (int32_t n); void - SetThreadID (lldb::tid_t thread_id); + SetThreadID (lldb::tid_t sb_thread_id); lldb::tid_t GetThreadID (); + + void + SetThreadIndex (uint32_t index); + + uint32_t + GetThreadIndex() const; + + void + SetThreadName (const char *thread_name); + + const char * + GetThreadName () const; + + void + SetQueueName (const char *queue_name); + + const char * + GetQueueName () const; bool IsResolved (); Modified: lldb/trunk/source/API/SBBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=106268&r1=106267&r2=106268&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpoint.cpp (original) +++ lldb/trunk/source/API/SBBreakpoint.cpp Thu Jun 17 20:47:08 2010 @@ -20,8 +20,9 @@ #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" #include "lldb/Target/Process.h" -#include "lldb/Target/Thread.h" #include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" +#include "lldb/Target/ThreadSpec.h" #include "lldb/lldb-enumerations.h" @@ -276,6 +277,70 @@ return lldb_thread_id; } +void +SBBreakpoint::SetThreadIndex (uint32_t index) +{ + if (m_break_sp) + m_break_sp->GetOptions()->GetThreadSpec()->SetIndex (index); +} + +uint32_t +SBBreakpoint::GetThreadIndex() const +{ + if (m_break_sp) + { + const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec(); + if (thread_spec == NULL) + return 0; + else + return thread_spec->GetIndex(); + } + return 0; +} + + +void +SBBreakpoint::SetThreadName (const char *thread_name) +{ + if (m_break_sp) + m_break_sp->GetOptions()->GetThreadSpec()->SetName (thread_name); +} + +const char * +SBBreakpoint::GetThreadName () const +{ + if (m_break_sp) + { + const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec(); + if (thread_spec == NULL) + return NULL; + else + return thread_spec->GetName(); + } + return NULL; +} + +void +SBBreakpoint::SetQueueName (const char *queue_name) +{ + if (m_break_sp) + m_break_sp->GetOptions()->GetThreadSpec()->SetQueueName (queue_name); +} + +const char * +SBBreakpoint::GetQueueName () const +{ + if (m_break_sp) + { + const ThreadSpec *thread_spec = m_break_sp->GetOptions()->GetThreadSpec(); + if (thread_spec == NULL) + return NULL; + else + return thread_spec->GetQueueName(); + } + return NULL; +} + size_t SBBreakpoint::GetNumResolvedLocations() const { Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=106268&r1=106267&r2=106268&view=diff ============================================================================== --- lldb/trunk/source/API/SBBreakpointLocation.cpp (original) +++ lldb/trunk/source/API/SBBreakpointLocation.cpp Thu Jun 17 20:47:08 2010 @@ -17,6 +17,7 @@ #include "lldb/Target/ThreadSpec.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamFile.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -108,6 +109,70 @@ return sb_thread_id; } +void +SBBreakpointLocation::SetThreadIndex (uint32_t index) +{ + if (m_break_loc_sp) + m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetIndex (index); +} + +uint32_t +SBBreakpointLocation::GetThreadIndex() const +{ + if (m_break_loc_sp) + { + const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec(); + if (thread_spec == NULL) + return 0; + else + return thread_spec->GetIndex(); + } + return 0; +} + + +void +SBBreakpointLocation::SetThreadName (const char *thread_name) +{ + if (m_break_loc_sp) + m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetName (thread_name); +} + +const char * +SBBreakpointLocation::GetThreadName () const +{ + if (m_break_loc_sp) + { + const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec(); + if (thread_spec == NULL) + return NULL; + else + return thread_spec->GetName(); + } + return NULL; +} + +void +SBBreakpointLocation::SetQueueName (const char *queue_name) +{ + if (m_break_loc_sp) + m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->SetQueueName (queue_name); +} + +const char * +SBBreakpointLocation::GetQueueName () const +{ + if (m_break_loc_sp) + { + const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec(); + if (thread_spec == NULL) + return NULL; + else + return thread_spec->GetQueueName(); + } + return NULL; +} + bool SBBreakpointLocation::IsResolved () { From jingham at apple.com Fri Jun 18 13:17:30 2010 From: jingham at apple.com (Jim Ingham) Date: Fri, 18 Jun 2010 18:17:30 -0000 Subject: [Lldb-commits] [lldb] r106297 - /lldb/trunk/source/Interpreter/CommandInterpreter.cpp Message-ID: <20100618181730.2DD582A6C12C@llvm.org> Author: jingham Date: Fri Jun 18 13:17:30 2010 New Revision: 106297 URL: http://llvm.org/viewvc/llvm-project?rev=106297&view=rev Log: Remove an include of the deleted CommandObjectStatus.h. Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=106297&r1=106296&r2=106297&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Jun 18 13:17:30 2010 @@ -41,7 +41,6 @@ #include "../Commands/CommandObjectShow.h" #include "../Commands/CommandObjectSource.h" #include "../Commands/CommandObjectSourceFile.h" -#include "../Commands/CommandObjectStatus.h" #include "../Commands/CommandObjectSyntax.h" #include "../Commands/CommandObjectTarget.h" #include "../Commands/CommandObjectThread.h" From jingham at apple.com Fri Jun 18 23:35:20 2010 From: jingham at apple.com (Jim Ingham) Date: Sat, 19 Jun 2010 04:35:20 -0000 Subject: [Lldb-commits] [lldb] r106377 - in /lldb/trunk/source/Commands: CommandObjectBreakpoint.cpp CommandObjectBreakpoint.h Message-ID: <20100619043520.A10602A6C12C@llvm.org> Author: jingham Date: Fri Jun 18 23:35:20 2010 New Revision: 106377 URL: http://llvm.org/viewvc/llvm-project?rev=106377&view=rev Log: Remember whether a queue or thread name were passed into "breakpoint modify" so we can recognize an empty argument as unsetting the option. Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp lldb/trunk/source/Commands/CommandObjectBreakpoint.h Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=106377&r1=106376&r2=106377&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Jun 18 23:35:20 2010 @@ -1095,10 +1095,18 @@ } break; case 'T': - m_thread_name = option_arg; + if (option_arg != NULL) + m_thread_name = option_arg; + else + m_thread_name.clear(); + m_name_passed = true; break; case 'q': - m_queue_name = option_arg; + if (option_arg != NULL) + m_queue_name = option_arg; + else + m_queue_name.clear(); + m_queue_passed = true; break; case 'x': { @@ -1127,6 +1135,8 @@ m_thread_name.clear(); m_queue_name.clear(); m_enable_passed = false; + m_queue_passed = false; + m_name_passed = false; } //------------------------------------------------------------------------- @@ -1201,10 +1211,10 @@ if (m_options.m_thread_index != -1) location->GetLocationOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); - if (!m_options.m_thread_name.empty()) + if (m_options.m_name_passed) location->GetLocationOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); - if (!m_options.m_queue_name.empty()) + if (m_options.m_queue_passed) location->GetLocationOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); if (m_options.m_ignore_count != -1) @@ -1222,10 +1232,10 @@ if (m_options.m_thread_index != -1) bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index); - if (!m_options.m_thread_name.empty()) + if (m_options.m_name_passed) bp->GetOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str()); - if (!m_options.m_queue_name.empty()) + if (m_options.m_queue_passed) bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str()); if (m_options.m_ignore_count != -1) Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=106377&r1=106376&r2=106377&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original) +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Fri Jun 18 23:35:20 2010 @@ -172,6 +172,8 @@ std::string m_queue_name; bool m_enable_passed; bool m_enable_value; + bool m_name_passed; + bool m_queue_passed; }; From jingham at apple.com Fri Jun 18 23:45:33 2010 From: jingham at apple.com (Jim Ingham) Date: Sat, 19 Jun 2010 04:45:33 -0000 Subject: [Lldb-commits] [lldb] r106378 - in /lldb/trunk: include/lldb/ include/lldb/Target/ lldb.xcodeproj/ source/API/ source/Commands/ source/Plugins/DynamicLoader/MacOSX-DYLD/ source/Target/ Message-ID: <20100619044533.6479F2A6C12C@llvm.org> Author: jingham Date: Fri Jun 18 23:45:32 2010 New Revision: 106378 URL: http://llvm.org/viewvc/llvm-project?rev=106378&view=rev Log: Two changes in this checkin. Added a ThreadPlanKind so that I can do some reasoning based on the kind of thread plan without having to use RTTI. Removed the ThreadPlanContinue and replaced with a ShouldAutoContinue query that serves the same purpose. Having to push another plan to assert that if there's no other indication the target should continue when this plan is popped was flakey and error prone. This method is more stable, and fixed problems we were having with thread specific breakpoints. Removed: lldb/trunk/include/lldb/Target/ThreadPlanContinue.h lldb/trunk/source/Target/ThreadPlanContinue.cpp Modified: lldb/trunk/include/lldb/Target/Thread.h lldb/trunk/include/lldb/Target/ThreadPlan.h lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h lldb/trunk/include/lldb/lldb-forward.h lldb/trunk/lldb.xcodeproj/project.pbxproj lldb/trunk/source/API/SBThread.cpp lldb/trunk/source/Commands/CommandObjectThread.cpp lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/Thread.cpp lldb/trunk/source/Target/ThreadList.cpp lldb/trunk/source/Target/ThreadPlan.cpp lldb/trunk/source/Target/ThreadPlanBase.cpp lldb/trunk/source/Target/ThreadPlanCallFunction.cpp lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp lldb/trunk/source/Target/ThreadPlanStepInRange.cpp lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp lldb/trunk/source/Target/ThreadPlanStepOut.cpp lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp lldb/trunk/source/Target/ThreadPlanStepRange.cpp lldb/trunk/source/Target/ThreadPlanStepThrough.cpp lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Modified: lldb/trunk/include/lldb/Target/Thread.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/Thread.h (original) +++ lldb/trunk/include/lldb/Target/Thread.h Fri Jun 18 23:45:32 2010 @@ -494,31 +494,6 @@ /// \b true if we discard the currently queued plans and replace them with this one. /// Otherwise this plan will go on the end of the plan stack. /// - /// @param[in] stop_other_threads - /// \b true if we will stop other threads while we single step this one. - /// - /// @param[in] stop_vote - /// @param[in] run_vote - /// See standard meanings for the stop & run votes in ThreadPlan.h. - /// - /// @return - /// A pointer to the newly queued thread plan, or NULL if the plan could not be queued. - //------------------------------------------------------------------ - virtual ThreadPlan * - QueueThreadPlanForContinue (bool abort_other_plans, - bool stop_other_threads, - lldb::Vote stop_vote, - lldb::Vote run_vote = lldb::eVoteNoOpinion, - bool immediate = false); - //------------------------------------------------------------------ - /// Gets the plan used to continue from the current PC. - /// This is a simple plan, mostly useful as a backstop when you are continuing - /// for some particular purpose. - /// - /// @param[in] abort_other_plans - /// \b true if we discard the currently queued plans and replace them with this one. - /// Otherwise this plan will go on the end of the plan stack. - /// /// @param[in] target_addr /// The address to which we're running. /// Modified: lldb/trunk/include/lldb/Target/ThreadPlan.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlan.h?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlan.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlan.h Fri Jun 18 23:45:32 2010 @@ -179,10 +179,27 @@ eThisThread } ThreadScope; + typedef enum + { + eKindGeneric, + eKindBase, + eKindCallFunction, + eKindStepInstruction, + eKindStepOut, + eKindStepOverBreakpoint, + eKindStepOverRange, + eKindStepInRange, + eKindRunToAddress, + eKindStepThrough, + eKindStepUntil + + } ThreadPlanKind; + //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - ThreadPlan (const char *name, + ThreadPlan (ThreadPlanKind kind, + const char *name, Thread &thread, lldb::Vote stop_vote, lldb::Vote run_vote); @@ -259,6 +276,12 @@ virtual bool ShouldStop (Event *event_ptr) = 0; + + virtual bool + ShouldAutoContinue (Event *event_ptr) + { + return false; + } // Whether a "stop class" event should be reported to the "outside world". In general // if a thread plan is active, events should not be reported. @@ -313,6 +336,11 @@ // This pushes \a plan onto the plan stack of the current plan's thread. void PushPlan (lldb::ThreadPlanSP &thread_plan_sp); + + ThreadPlanKind GetKind() const + { + return m_kind; + } protected: //------------------------------------------------------------------ @@ -342,6 +370,7 @@ //------------------------------------------------------------------ static lldb::user_id_t GetNextID (); + ThreadPlanKind m_kind; std::string m_name; Mutex m_plan_complete_mutex; bool m_plan_complete; Removed: lldb/trunk/include/lldb/Target/ThreadPlanContinue.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanContinue.h?rev=106377&view=auto ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanContinue.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanContinue.h (removed) @@ -1,60 +0,0 @@ -//===-- ThreadPlanContinue.h ------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_ThreadPlanContinue_h_ -#define liblldb_ThreadPlanContinue_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" -#include "lldb/Target/ThreadPlan.h" - -namespace lldb_private { - -class ThreadPlanContinue : public ThreadPlan -{ -public: - ThreadPlanContinue (Thread &thread, - bool stop_others, - lldb::Vote stop_vote, - lldb::Vote run_vote, - bool immediate = false); - virtual ~ThreadPlanContinue (); - - virtual void GetDescription (Stream *s, lldb::DescriptionLevel level); - - virtual bool ValidatePlan (Stream *error); - - virtual bool PlanExplainsStop (); - virtual bool ShouldStop (Event *event_ptr); - virtual bool StopOthers (); - virtual lldb::StateType RunState (); - virtual bool IsImmediate () const; - virtual bool WillResume (lldb::StateType resume_state, bool current_plan); - virtual bool WillStop (); - virtual bool MischiefManaged (); - -protected: - bool InRange(); -private: - bool m_stop_others; - bool m_did_run; - bool m_immediate; - // Need an appropriate marker for the current stack so we can tell step out - // from step in. - - DISALLOW_COPY_AND_ASSIGN (ThreadPlanContinue); - -}; - -} // namespace lldb_private - -#endif // liblldb_ThreadPlanContinue_h_ Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepOverBreakpoint.h Fri Jun 18 23:45:32 2010 @@ -38,6 +38,8 @@ virtual bool WillResume (lldb::StateType resume_state, bool current_plan); virtual bool WillStop (); virtual bool MischiefManaged (); + void SetAutoContinue (bool do_it); + virtual bool ShouldAutoContinue(Event *event_ptr); protected: @@ -45,6 +47,7 @@ lldb::addr_t m_breakpoint_addr; lldb::user_id_t m_breakpoint_site_id; + bool m_auto_continue; DISALLOW_COPY_AND_ASSIGN (ThreadPlanStepOverBreakpoint); Modified: lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h (original) +++ lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h Fri Jun 18 23:45:32 2010 @@ -39,7 +39,8 @@ protected: - ThreadPlanStepRange (const char *name, + ThreadPlanStepRange (ThreadPlanKind kind, + const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, Modified: lldb/trunk/include/lldb/lldb-forward.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-forward.h?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-forward.h (original) +++ lldb/trunk/include/lldb/lldb-forward.h Fri Jun 18 23:45:32 2010 @@ -121,7 +121,6 @@ class Thread; class ThreadList; class ThreadPlan; -class ThreadPlanContinue; class ThreadPlanBase; class ThreadPlanStepInstruction; class ThreadPlanStepOut; Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Jun 18 23:45:32 2010 @@ -194,7 +194,6 @@ 26D5B0EA11B07550009A862E /* ThreadList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F3E10F1B90C00F91463 /* ThreadList.cpp */; }; 26D5B0EB11B07550009A862E /* ThreadPlan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F3F10F1B90C00F91463 /* ThreadPlan.cpp */; }; 26D5B0EC11B07550009A862E /* ObjectFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7F4C10F1BC1A00F91463 /* ObjectFile.cpp */; }; - 26D5B0ED11B07550009A862E /* ThreadPlanContinue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847010F50EFC00BB2B04 /* ThreadPlanContinue.cpp */; }; 26D5B0EE11B07550009A862E /* ThreadPlanBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */; }; 26D5B0EF11B07550009A862E /* ThreadPlanStepInstruction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847210F50EFC00BB2B04 /* ThreadPlanStepInstruction.cpp */; }; 26D5B0F011B07550009A862E /* ThreadPlanStepOut.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 260C847310F50EFC00BB2B04 /* ThreadPlanStepOut.cpp */; }; @@ -392,14 +391,12 @@ 260223E8115F06E500A601A2 /* SBCommunication.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBCommunication.cpp; path = source/API/SBCommunication.cpp; sourceTree = ""; }; 26022531115F27FA00A601A2 /* SBFileSpec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFileSpec.h; path = include/lldb/API/SBFileSpec.h; sourceTree = ""; }; 26022532115F281400A601A2 /* SBFileSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBFileSpec.cpp; path = source/API/SBFileSpec.cpp; sourceTree = ""; }; - 260C847010F50EFC00BB2B04 /* ThreadPlanContinue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanContinue.cpp; path = source/Target/ThreadPlanContinue.cpp; sourceTree = ""; }; 260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanBase.cpp; path = source/Target/ThreadPlanBase.cpp; sourceTree = ""; }; 260C847210F50EFC00BB2B04 /* ThreadPlanStepInstruction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepInstruction.cpp; path = source/Target/ThreadPlanStepInstruction.cpp; sourceTree = ""; }; 260C847310F50EFC00BB2B04 /* ThreadPlanStepOut.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOut.cpp; path = source/Target/ThreadPlanStepOut.cpp; sourceTree = ""; }; 260C847410F50EFC00BB2B04 /* ThreadPlanStepOverBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepOverBreakpoint.cpp; path = source/Target/ThreadPlanStepOverBreakpoint.cpp; sourceTree = ""; }; 260C847510F50EFC00BB2B04 /* ThreadPlanStepThrough.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepThrough.cpp; path = source/Target/ThreadPlanStepThrough.cpp; sourceTree = ""; }; 260C847610F50EFC00BB2B04 /* ThreadPlanStepRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanStepRange.cpp; path = source/Target/ThreadPlanStepRange.cpp; sourceTree = ""; }; - 260C847E10F50F0A00BB2B04 /* ThreadPlanContinue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanContinue.h; path = include/lldb/Target/ThreadPlanContinue.h; sourceTree = ""; }; 260C847F10F50F0A00BB2B04 /* ThreadPlanBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanBase.h; path = include/lldb/Target/ThreadPlanBase.h; sourceTree = ""; }; 260C848010F50F0A00BB2B04 /* ThreadPlanStepInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepInstruction.h; path = include/lldb/Target/ThreadPlanStepInstruction.h; sourceTree = ""; }; 260C848110F50F0A00BB2B04 /* ThreadPlanStepOut.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanStepOut.h; path = include/lldb/Target/ThreadPlanStepOut.h; sourceTree = ""; }; @@ -1940,8 +1937,6 @@ 260C847110F50EFC00BB2B04 /* ThreadPlanBase.cpp */, 49EC3E9C118F90D400B1265E /* ThreadPlanCallFunction.h */, 49EC3E98118F90AC00B1265E /* ThreadPlanCallFunction.cpp */, - 260C847E10F50F0A00BB2B04 /* ThreadPlanContinue.h */, - 260C847010F50EFC00BB2B04 /* ThreadPlanContinue.cpp */, 4C43DEF9110641F300E55CBF /* ThreadPlanShouldStopHere.h */, 4C43DEFA110641F300E55CBF /* ThreadPlanShouldStopHere.cpp */, 260C848010F50F0A00BB2B04 /* ThreadPlanStepInstruction.h */, @@ -2501,7 +2496,6 @@ 26D5B0EA11B07550009A862E /* ThreadList.cpp in Sources */, 26D5B0EB11B07550009A862E /* ThreadPlan.cpp in Sources */, 26D5B0EC11B07550009A862E /* ObjectFile.cpp in Sources */, - 26D5B0ED11B07550009A862E /* ThreadPlanContinue.cpp in Sources */, 26D5B0EE11B07550009A862E /* ThreadPlanBase.cpp in Sources */, 26D5B0EF11B07550009A862E /* ThreadPlanStepInstruction.cpp in Sources */, 26D5B0F011B07550009A862E /* ThreadPlanStepOut.cpp in Sources */, Modified: lldb/trunk/source/API/SBThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/API/SBThread.cpp (original) +++ lldb/trunk/source/API/SBThread.cpp Fri Jun 18 23:45:32 2010 @@ -19,7 +19,6 @@ #include "lldb/Symbol/CompileUnit.h" #include "lldb/Target/Target.h" #include "lldb/Target/ThreadPlan.h" -#include "lldb/Target/ThreadPlanContinue.h" #include "lldb/Target/ThreadPlanStepInstruction.h" #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Target/ThreadPlanStepRange.h" Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Jun 18 23:45:32 2010 @@ -25,7 +25,6 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" -#include "lldb/Target/ThreadPlanContinue.h" #include "lldb/Target/ThreadPlanStepInstruction.h" #include "lldb/Target/ThreadPlanStepOut.h" #include "lldb/Target/ThreadPlanStepRange.h" Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/ThreadPlanStepThroughObjCTrampoline.cpp Fri Jun 18 23:45:32 2010 @@ -33,7 +33,7 @@ lldb::addr_t class_ptr, lldb::addr_t sel_ptr, bool stop_others) : - ThreadPlan ("MacOSX Step through ObjC Trampoline", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindGeneric, "MacOSX Step through ObjC Trampoline", thread, eVoteNoOpinion, eVoteNoOpinion), m_objc_trampoline_handler (trampoline_handler), m_impl_function (trampoline_handler->GetLookupImplementationWrapperFunction()), m_args_addr (args_addr), Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Fri Jun 18 23:45:32 2010 @@ -1313,7 +1313,7 @@ // We've stopped. First see if we're going to restart the target. // If we are going to stop, then we always broadcast the event. // If we aren't going to stop, let the thread plans decide if we're going to report this event. - // If no thread has an opinion, we also report it. + // If no thread has an opinion, we don't report it. if (state != eStateInvalid) { @@ -1326,8 +1326,6 @@ case eVoteYes: Process::ProcessEventData::SetRestartedInEvent (event_ptr, true); case eVoteNoOpinion: - return_value = true; - break; case eVoteNo: return_value = false; break; Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Fri Jun 18 23:45:32 2010 @@ -20,7 +20,6 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanCallFunction.h" -#include "lldb/Target/ThreadPlanContinue.h" #include "lldb/Target/ThreadPlanBase.h" #include "lldb/Target/ThreadPlanStepInstruction.h" #include "lldb/Target/ThreadPlanStepOut.h" @@ -431,28 +430,22 @@ { // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the target may not require anything // special to step over a breakpoint. - - // TODO: Jim Ingham -- this is the only place left that does RTTI in - // all of LLDB. I am adding a hack right now to let us compile - // without RTTI, but we will need to look at and fix this. Right - // now it will always push the breakpoint thread plan which is - // probably wrong. We will need to work around this. - -// ThreadPlan *cur_plan = GetCurrentPlan(); -// ThreadPlanStepOverBreakpoint *step_over_bp = dynamic_cast (cur_plan); -// if (step_over_bp == NULL) - { + + ThreadPlan *cur_plan = GetCurrentPlan(); - ThreadPlanSP step_bp_plan_sp (new ThreadPlanStepOverBreakpoint (*this)); - if (step_bp_plan_sp) + if (cur_plan->GetKind() != ThreadPlan::eKindStepOverBreakpoint) + { + ThreadPlanStepOverBreakpoint *step_bp_plan = new ThreadPlanStepOverBreakpoint (*this); + if (step_bp_plan) { + ThreadPlanSP step_bp_plan_sp; + step_bp_plan->SetPrivate (true); + if (GetCurrentPlan()->RunState() != eStateStepping) { - ThreadPlanSP continue_plan_sp (new ThreadPlanContinue(*this, false, eVoteNo, eVoteNoOpinion)); - continue_plan_sp->SetPrivate (true); - QueueThreadPlan (continue_plan_sp, false); + step_bp_plan->SetAutoContinue(true); } - step_bp_plan_sp->SetPrivate (true); + step_bp_plan_sp.reset (step_bp_plan); QueueThreadPlan (step_bp_plan_sp, false); } } @@ -524,6 +517,7 @@ if (current_plan->PlanExplainsStop()) { + bool over_ride_stop = current_plan->ShouldAutoContinue(event_ptr); while (1) { should_stop = current_plan->ShouldStop(event_ptr); @@ -558,6 +552,8 @@ break; } } + if (over_ride_stop) + should_stop = false; } else { @@ -949,14 +945,6 @@ } ThreadPlan * -Thread::QueueThreadPlanForContinue (bool abort_other_plans, bool stop_other_threads, Vote stop_vote, Vote run_vote, bool immediate) -{ - ThreadPlanSP thread_plan_sp (new ThreadPlanContinue (*this, stop_other_threads, stop_vote, run_vote, immediate)); - QueueThreadPlan (thread_plan_sp, abort_other_plans); - return thread_plan_sp.get(); -} - -ThreadPlan * Thread::QueueThreadPlanForCallFunction (bool abort_other_plans, Address& function, lldb::addr_t arg, Modified: lldb/trunk/source/Target/ThreadList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadList.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadList.cpp (original) +++ lldb/trunk/source/Target/ThreadList.cpp Fri Jun 18 23:45:32 2010 @@ -178,7 +178,7 @@ // Running events should never stop, obviously... - bool should_stop = false; + bool should_stop = false; m_process->UpdateThreadListIfNeeded(); collection::iterator pos, end = m_threads.end(); @@ -189,12 +189,12 @@ for (pos = m_threads.begin(); pos != end; ++pos) { ThreadSP thread_sp(*pos); - if ((thread_sp->ThreadStoppedForAReason()) - && (thread_sp->GetResumeState () != eStateSuspended)) + if ((thread_sp->GetResumeState () != eStateSuspended) && (thread_sp->ThreadStoppedForAReason())) { - should_stop |= thread_sp->ShouldStop(event_ptr); + should_stop |= thread_sp->ShouldStop(event_ptr); } } + if (should_stop) { for (pos = m_threads.begin(); pos != end; ++pos) Modified: lldb/trunk/source/Target/ThreadPlan.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlan.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlan.cpp (original) +++ lldb/trunk/source/Target/ThreadPlan.cpp Fri Jun 18 23:45:32 2010 @@ -23,7 +23,8 @@ //---------------------------------------------------------------------- // ThreadPlan constructor //---------------------------------------------------------------------- -ThreadPlan::ThreadPlan(const char *name, Thread &thread, Vote stop_vote, Vote run_vote) : +ThreadPlan::ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote stop_vote, Vote run_vote) : + m_kind (kind), m_name (name), m_thread (thread), m_plan_complete(false), Modified: lldb/trunk/source/Target/ThreadPlanBase.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanBase.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanBase.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanBase.cpp Fri Jun 18 23:45:32 2010 @@ -21,8 +21,6 @@ #include "lldb/Core/Stream.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" -#include "lldb/Target/ThreadPlanContinue.h" -#include "lldb/Target/ThreadPlanStepOverBreakpoint.h" using namespace lldb; using namespace lldb_private; @@ -34,7 +32,7 @@ //---------------------------------------------------------------------- ThreadPlanBase::ThreadPlanBase (Thread &thread) : - ThreadPlan("base plan", thread, eVoteYes, eVoteNoOpinion) + ThreadPlan(ThreadPlan::eKindBase, "base plan", thread, eVoteYes, eVoteNoOpinion) { } @@ -94,13 +92,16 @@ { // We want to step over the breakpoint and then continue. So push these two plans. - StoppointCallbackContext hit_context(event_ptr, &m_thread.GetProcess(), &m_thread, m_thread.GetStackFrameAtIndex(0).get()); - bool should_stop = m_thread.GetProcess().GetBreakpointSiteList().ShouldStop(&hit_context, bp_site_sp->GetID()); + StoppointCallbackContext hit_context(event_ptr, &m_thread.GetProcess(), &m_thread, + m_thread.GetStackFrameAtIndex(0).get()); + bool should_stop = m_thread.GetProcess().GetBreakpointSiteList().ShouldStop(&hit_context, + bp_site_sp->GetID()); if (!should_stop) { - // If we aren't going to stop at this breakpoint, and it is internal, don't report this stop or the subsequent - // running event. Otherwise we will post the stopped & running, but the stopped event will get marked + // If we aren't going to stop at this breakpoint, and it is internal, + // don't report this stop or the subsequent running event. + // Otherwise we will post the stopped & running, but the stopped event will get marked // with "restarted" so the UI will know to wait and expect the consequent "running". uint32_t i; bool is_wholly_internal = true; Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Fri Jun 18 23:45:32 2010 @@ -35,7 +35,7 @@ lldb::addr_t arg, bool stop_other_threads, bool discard_on_error) : - ThreadPlan ("Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion), m_valid(false), m_process(thread.GetProcess()), m_arg_addr (arg), @@ -89,7 +89,7 @@ ValueList &args, bool stop_other_threads, bool discard_on_error) : - ThreadPlan ("Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion), m_valid(false), m_process(thread.GetProcess()), m_arg_addr (0), Removed: lldb/trunk/source/Target/ThreadPlanContinue.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanContinue.cpp?rev=106377&view=auto ============================================================================== --- lldb/trunk/source/Target/ThreadPlanContinue.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanContinue.cpp (removed) @@ -1,120 +0,0 @@ -//===-- ThreadPlanContinue.cpp ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Target/ThreadPlanContinue.h" - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private-log.h" -#include "lldb/Core/Log.h" -#include "lldb/Core/Stream.h" - -using namespace lldb; -using namespace lldb_private; - -//---------------------------------------------------------------------- -// ThreadPlanContinue: Continue plan -//---------------------------------------------------------------------- - -ThreadPlanContinue::ThreadPlanContinue (Thread &thread, bool stop_others, Vote stop_vote, Vote run_vote, bool immediate) : - ThreadPlan ("Continue after previous plan", thread, stop_vote, run_vote), - m_stop_others (stop_others), - m_did_run (false), - m_immediate (immediate) -{ -} - -ThreadPlanContinue::~ThreadPlanContinue () -{ -} - -void -ThreadPlanContinue::GetDescription (Stream *s, lldb::DescriptionLevel level) -{ - if (level == lldb::eDescriptionLevelBrief) - s->Printf ("continue"); - else - { - s->Printf ("Continue from the previous plan"); - } -} - -bool -ThreadPlanContinue::ValidatePlan (Stream *error) -{ - // Since we read the instruction we're stepping over from the thread, - // this plan will always work. - return true; -} - -bool -ThreadPlanContinue::PlanExplainsStop () -{ - return true; -} - -bool -ThreadPlanContinue::ShouldStop (Event *event_ptr) -{ - return false; -} - -bool -ThreadPlanContinue::IsImmediate () const -{ - return m_immediate; - return false; -} - -bool -ThreadPlanContinue::StopOthers () -{ - return m_stop_others; -} - -StateType -ThreadPlanContinue::RunState () -{ - return eStateRunning; -} - -bool -ThreadPlanContinue::WillResume (StateType resume_state, bool current_plan) -{ - ThreadPlan::WillResume (resume_state, current_plan); - if (current_plan) - { - m_did_run = true; - } - return true; -} - -bool -ThreadPlanContinue::WillStop () -{ - return true; -} - -bool -ThreadPlanContinue::MischiefManaged () -{ - Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); - - if (m_did_run) - { - if (log) - log->Printf("Completed continue plan."); - ThreadPlan::MischiefManaged (); - return true; - } - else - return false; -} Modified: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp Fri Jun 18 23:45:32 2010 @@ -34,7 +34,7 @@ Address &address, bool stop_others ) : - ThreadPlan ("Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion), m_stop_others (stop_others), m_address (LLDB_INVALID_ADDRESS), m_break_id (LLDB_INVALID_BREAK_ID) @@ -49,7 +49,7 @@ lldb::addr_t address, bool stop_others ) : - ThreadPlan ("Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindRunToAddress, "Run to breakpoint plan", thread, eVoteNoOpinion, eVoteNoOpinion), m_stop_others (stop_others), m_address (address), m_break_id (LLDB_INVALID_BREAK_ID) Modified: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInRange.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp Fri Jun 18 23:45:32 2010 @@ -40,7 +40,7 @@ const SymbolContext &addr_context, lldb::RunMode stop_others ) : - ThreadPlanStepRange ("Step Range stepping in", thread, range, addr_context, stop_others), + ThreadPlanStepRange (ThreadPlan::eKindStepInRange, "Step Range stepping in", thread, range, addr_context, stop_others), ThreadPlanShouldStopHere (this, ThreadPlanStepInRange::DefaultShouldStopHereCallback, NULL) { SetFlagsToDefault (); Modified: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp Fri Jun 18 23:45:32 2010 @@ -37,12 +37,11 @@ Vote stop_vote, Vote run_vote ) : - ThreadPlan ("Step over single instruction", thread, stop_vote, run_vote), + ThreadPlan (ThreadPlan::eKindStepInstruction, "Step over single instruction", thread, stop_vote, run_vote), m_instruction_addr (0), m_step_over (step_over), m_stack_depth(0), - m_stop_other_threads (stop_other_threads) -{ + m_stop_other_threads (stop_other_threads){ m_instruction_addr = m_thread.GetRegisterContext()->GetPC(0); m_stack_depth = m_thread.GetStackFrameCount(); } Modified: lldb/trunk/source/Target/ThreadPlanStepOut.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOut.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOut.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp Fri Jun 18 23:45:32 2010 @@ -36,7 +36,7 @@ Vote stop_vote, Vote run_vote ) : - ThreadPlan ("Step out", thread, stop_vote, run_vote), + ThreadPlan (ThreadPlan::eKindStepOut, "Step out", thread, stop_vote, run_vote), m_step_from_context (context), m_step_from_insn (LLDB_INVALID_ADDRESS), m_return_addr (LLDB_INVALID_ADDRESS), Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Fri Jun 18 23:45:32 2010 @@ -27,13 +27,15 @@ //---------------------------------------------------------------------- ThreadPlanStepOverBreakpoint::ThreadPlanStepOverBreakpoint (Thread &thread) : - ThreadPlan ("Step over breakpoint trap", + ThreadPlan (ThreadPlan::eKindStepOverBreakpoint, "Step over breakpoint trap", thread, eVoteNo, eVoteNoOpinion), // We need to report the run since this happens // first in the thread plan stack when stepping // over a breakpoint - m_breakpoint_addr (LLDB_INVALID_ADDRESS) + m_breakpoint_addr (LLDB_INVALID_ADDRESS), + m_auto_continue(false) + { m_breakpoint_addr = m_thread.GetRegisterContext()->GetPC(); m_breakpoint_site_id = m_thread.GetProcess().GetBreakpointSiteList().FindIDByAddress (m_breakpoint_addr); @@ -128,3 +130,14 @@ } } +void +ThreadPlanStepOverBreakpoint::SetAutoContinue (bool do_it) +{ + m_auto_continue = do_it; +} + +bool +ThreadPlanStepOverBreakpoint::ShouldAutoContinue (Event *event_ptr) +{ + return m_auto_continue; +} Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Fri Jun 18 23:45:32 2010 @@ -39,7 +39,7 @@ lldb::RunMode stop_others, bool okay_to_discard ) : - ThreadPlanStepRange ("Step range stepping over", thread, range, addr_context, stop_others) + ThreadPlanStepRange (ThreadPlan::eKindStepOverRange, "Step range stepping over", thread, range, addr_context, stop_others) { SetOkayToDiscard (okay_to_discard); } Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Fri Jun 18 23:45:32 2010 @@ -32,8 +32,8 @@ // based on the value of \a type. //---------------------------------------------------------------------- -ThreadPlanStepRange::ThreadPlanStepRange (const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) : - ThreadPlan (name, thread, eVoteNoOpinion, eVoteNoOpinion), +ThreadPlanStepRange::ThreadPlanStepRange (ThreadPlanKind kind, const char *name, Thread &thread, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_others) : + ThreadPlan (ThreadPlan::eKindGeneric, name, thread, eVoteNoOpinion, eVoteNoOpinion), m_address_range (range), m_addr_context (addr_context), m_stop_others (stop_others), Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Fri Jun 18 23:45:32 2010 @@ -30,7 +30,7 @@ //---------------------------------------------------------------------- ThreadPlanStepThrough::ThreadPlanStepThrough (Thread &thread, bool stop_others) : - ThreadPlan ("Step through trampolines and prologues", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindStepThrough, "Step through trampolines and prologues", thread, eVoteNoOpinion, eVoteNoOpinion), m_start_address (0), m_stop_others (stop_others) { Modified: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepUntil.cpp?rev=106378&r1=106377&r2=106378&view=diff ============================================================================== --- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp Fri Jun 18 23:45:32 2010 @@ -38,7 +38,7 @@ size_t num_addresses, bool stop_others ) : - ThreadPlan ("Step out", thread, eVoteNoOpinion, eVoteNoOpinion), + ThreadPlan (ThreadPlan::eKindStepUntil, "Step until", thread, eVoteNoOpinion, eVoteNoOpinion), m_step_from_insn (LLDB_INVALID_ADDRESS), m_return_addr (LLDB_INVALID_ADDRESS), m_return_bp_id(LLDB_INVALID_BREAK_ID),