Commit Graph

1380 Commits

Author SHA1 Message Date
Greg Clayton 037520e9cf Cleaned up the lldb_private::Mangled class to get rid of the tokenizing code that has bit rotted and isn't being used. Also cleaned up the API to the "lldb_private::Mangled" to always take "const ConstString &" arguments instead of both "const ConstString &" and "const char *".
llvm-svn: 160466
2012-07-18 23:18:10 +00:00
Greg Clayton 5e0c5e8108 <rdar://problem/10998370>
Improved the error message when we can find a function in the current program by printing the demangled name.

Also added the ability to create lldb_private::Mangled instances with a ConstString when we already have a ConstString for a mangled or demangled name. Also added the ability to call SetValue with a ConstString and also without a boolean to indicate if the string is mangled where we will now auto-detect if the string is mangled.

llvm-svn: 160450
2012-07-18 20:47:40 +00:00
Greg Clayton 358a789744 Cleaned up incorrect STL std::map comparison code and use the operator == on std::map objects instead of manually implementing the comparisons. Also modified the UnwindPlan::AppendRow() function to take a "const RowSP &" object so we don't have to copy shared pointers when calling this function.
llvm-svn: 160448
2012-07-18 20:37:53 +00:00
Jason Molenda 24a8378c4f Change UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly so it records
the state of the unwind instructions once the prologue has finished.  If it hits an
early return epilogue in the middle of the function, re-instate the prologue after that
epilogue has completed so that we can still unwind for cases where the flow of control
goes past that early-return.  <rdar://problem/11775059>

Move the UnwindPlan operator== definition into the .cpp file, expand the definition a bit.

Add some casts to a SBCommandInterpreter::HandleCompletion() log statement so it builds without
warning on 64- and 32-bit systems.

llvm-svn: 160337
2012-07-17 01:57:24 +00:00
Jim Ingham ab728678ee Lock around reading as well as connecting & disconnecting so we don't start reading after
someone has set our file descriptor to -1 and crash in FD_SET...
<rdar://problem/11653966>

llvm-svn: 160336
2012-07-17 01:47:11 +00:00
Enrico Granata 3372f581eb <rdar://problem/11672978> Fixing an issue where an ObjC object might come out without a description because the expression used to obtain it would timeout before running to completion
llvm-svn: 160326
2012-07-16 23:10:35 +00:00
Jason Molenda 1d42c7bc32 Switch nearly all of the use of the UnwindPlan::Row's to go through
a shared pointer to ease some memory management issues with a patch
I'm working on.

The main complication with using SPs for these objects is that most
methods that build up an UnwindPlan will construct a Row to a given
instruction point in a function, then add additional regsaves in
the next instruction point to that row and push it again.  A little
care is needed to not mutate the previous instruction point's Row
once these are switched to being held behing shared pointers.

llvm-svn: 160214
2012-07-14 04:52:53 +00:00
Greg Clayton 685c88c5a8 <rdar://problem/11870357>
Allow "frame variable" to find ivars without the need for "this->" or "self->".  

llvm-svn: 160211
2012-07-14 00:53:55 +00:00
Enrico Granata f04a21917c <rdar://problem/11782789> Changes to the watchpoint implementation on ARM so that we single-step before stopping at the WP. This is necessary because on ARM the WP triggers before the opcode is actually executed, so we would be unable to continue since we would keep hitting the WP. We work around this by disabling the WP, single stepping and then putting the WP back in place.
llvm-svn: 160199
2012-07-13 23:18:48 +00:00
Jim Ingham 18b4689639 Add accessors on process to get & set the selected thread by IndexID (useful since that's the one that "thread list" shows and it won't get reused even if the underlying system thread ID gets reused.
llvm-svn: 160187
2012-07-13 20:18:18 +00:00
Greg Clayton 1d60909e81 <rdar://problem/11740973>
Fixed issues that could happen when the UUID doesn't change in a binary and old stale debug info could end up being used.

llvm-svn: 160145
2012-07-12 22:51:12 +00:00
Greg Clayton 4e0fe8ab95 <rdar://problem/11791234>
Fixed a case where the python interpreter could end up holding onto a previous lldb::SBProcess (probably in lldb.process) when run under Xcode. Prior to this fix, the lldb::SBProcess held onto a shared pointer to a lldb_private::Process. This in turn could cause the process to still have a thread list with stack frames. The stack frames would have module shared pointers in the lldb_private::SymbolContext objects. 

We also had issues with things staying in the shared module list too long when we found things by UUID (we didn't remove the out of date ModuleSP from the global module cache).

Now all of this is fixed and everything goes away between runs.

llvm-svn: 160140
2012-07-12 20:32:19 +00:00
Jim Ingham 17ce5b977b Add a command channel to wait on along with the file descriptor the ConnectionFileDescriptor class is managing, so we can always pop ourselves out of our select call regardless of how well behaved the channel we are talking to is.
<rdar://problem/11448282>

llvm-svn: 160100
2012-07-12 01:17:55 +00:00
Sean Callanan 7d69f12e75 Added a mutex to the call frame info to guard
generation of the FDE index.

<rdar://problem/11813705>

llvm-svn: 160099
2012-07-12 01:11:40 +00:00
Jason Molenda 380241a81f Add a new 'target modules show-unwind' command to show the different
UnwindPlans for a function.  This specifically does not use any
previously-generated UnwindPlans so if any logging is performed
while creating the UnwindPlans, it will be repeated.  This is
useful for when an lldb stack trace is not correct and you want
to gather diagnostic information from the user -- they can do 
log enable -v lldb unwind, image show-unwind of the function, and
you'll get the full logging as the UnwindPlans are recreated.

llvm-svn: 160095
2012-07-12 00:20:07 +00:00
Greg Clayton c3a86bf9f0 Modifying the "address" format, which prints a pointer and a description of what it points to, to detect when the deref of that pointer points to something valid. So if you have:
% cat sp.cpp 
    #include <tr1/memory>

    class A
    {
    public:
        A (): m_i (12) {}
        virtual ~A() {}
    private:
        int m_i;
    };

    int main (int argc, char const *argv[], char const *envp[])
    {
        A *a_pointers[2] = { NULL, NULL };
        A a1;
        A a2;
        a_pointers[0] = &a1;
        a_pointers[1] = &a2;
        return 0;
    }


And you stop at the "return 0", you can now read memory using the "address" format and see:

(lldb) memory read --format address `&a_pointers`
0x7fff5fbff870: 0x00007fff5fbff860 -> 0x00000001000010b0 vtable for A + 16
0x7fff5fbff878: 0x00007fff5fbff850 -> 0x00000001000010b0 vtable for A + 16
0x7fff5fbff880: 0x00007fff5fbff8d0
0x7fff5fbff888: 0x00007fff5fbff8c0
0x7fff5fbff890: 0x0000000000000001
0x7fff5fbff898: 0x36d54c275add2294
0x7fff5fbff8a0: 0x00007fff5fbff8b0
0x7fff5fbff8a8: 0x0000000100000bb4 a.out`start + 52

Note the extra dereference that was applied to 0x00007fff5fbff860 and 0x00007fff5fbff850 so we can see that these are "A" classes.

llvm-svn: 160085
2012-07-11 22:18:24 +00:00
Greg Clayton 53eb7ad2f7 <rdar://problem/11852100>
The "stop-line-count-after" and "stop-line-count-before" settings are broken. This fixes them.

llvm-svn: 160071
2012-07-11 20:33:48 +00:00
Filipe Cabecinhas 5137f317ce Fixed typos found while reading commit logs.
llvm-svn: 159930
2012-07-09 13:42:24 +00:00
Jason Molenda 75b9cfd1f0 Simplify the CreateDefaultUnwindPlan methods for the x86 and arm unwinders
a bit -- we're creating the UnwindPlan here, we can set the register set to
whatever is convenient for us, no need to handle different register sets.

A handful of small comment fixes I noticed while reading through the code.

llvm-svn: 159924
2012-07-09 07:47:47 +00:00
Greg Clayton 7820bd1e52 <rdar://problem/11357711>
Fixed a crasher where the section load list was not thread safe.

llvm-svn: 159884
2012-07-07 01:24:12 +00:00
Greg Clayton 9407302d37 Make const result value objects able to return dynamic types.
Modified the heap.py to be able to correctly indentify the exact ivar for the "ptr_refs" command no matter how deep the ivar is in a class hierarchy. Also fixed the ability for the heap command to symbolicate the stack backtrace when MallocStackLogging is set in the environment and the "--stack" option was specified.

llvm-svn: 159883
2012-07-07 01:22:45 +00:00
Sean Callanan ec440dd774 Since SBTarget::FindFunctions returns a
SBSymbolContextList, we should include the
relevant header file.

llvm-svn: 159840
2012-07-06 17:44:41 +00:00
Jim Ingham 43c555dfcd Work around some problems destroying a process with older debugservers.
rdar://problem/11359989

llvm-svn: 159697
2012-07-04 00:35:43 +00:00
Jim Ingham 03afad8f1e Add an "extra-startup-commands" process setting so we can send some command strings to the actual process plugin to interpret as it wishes.
llvm-svn: 159511
2012-07-02 05:40:07 +00:00
Greg Clayton 9a69ac5d67 Spelling fixes.
llvm-svn: 159467
2012-06-29 21:58:52 +00:00
Greg Clayton fed39aa653 Added the ability to read the dSYM plist file with source remappings even when DebugSymbols isn't used to find the dSYM. We now parse the plist as XML in the MacOSX symbol vendor.
Added the ability to get a section load address given a target which is needed for a previous checking which saves crashlogs.

llvm-svn: 159298
2012-06-27 22:22:28 +00:00
Jim Ingham 70f11f88e3 Make a way to set the result status for Python defined commands, and don't overwrite the status of the result if
the python command has set it.

llvm-svn: 159273
2012-06-27 17:25:36 +00:00
Jim Ingham 0fd1b75f50 Fix ignore counts on breakpoints so they actually work.
llvm-svn: 159233
2012-06-26 22:27:55 +00:00
Jim Ingham 4ceb928f02 Change the Mutex::Locker class so that it takes the Mutex object and locks it, rather
than being given the pthread_mutex_t from the Mutex and locks that.  That allows us to
track ownership of the Mutex better.  

Used this to switch the LLDB_CONFIGURATION_DEBUG enabled assert when we can't get the
gdb-remote sequence mutex to assert when the thread that had the mutex releases it.  This
is generally more useful information than saying just who failed to get it (since the
code that had it locked often had released it by the time the assert fired.)

llvm-svn: 158240
2012-06-08 22:50:40 +00:00
Jim Ingham 5a98841673 Make raw & parsed commands subclasses of CommandObject rather than having the raw version implement an
Execute which was never going to get run and another ExecuteRawCommandString.  Took the knowledge of how
to prepare raw & parsed commands out of CommandInterpreter and put it in CommandObject where it belongs.

Also took all the cases where there were the subcommands of Multiword commands declared in the .h file for
the overall command and moved them into the .cpp file.

Made the CommandObject flags work for raw as well as parsed commands.

Made "expr" use the flags so that it requires you to be paused to run "expr".

llvm-svn: 158235
2012-06-08 21:56:10 +00:00
Sean Callanan 5677536bff Committed a change to the SectionList that introduces
a cache of address ranges for child sections,
accelerating lookups.  This cache is built during
object file loading, and is then set in stone once
the object files are done loading.  (In Debug builds,
we ensure that the cache is never invalidated after
that.)

llvm-svn: 158188
2012-06-08 02:16:08 +00:00
Sean Callanan 64c0cf2134 Added a setting (target.process.disable-memory-cache)
that controls whether memory is cached.  This is off
by default (i.e., memory is cached) because it greatly
improves performance.

llvm-svn: 158173
2012-06-07 22:26:42 +00:00
Enrico Granata 79cc6f7a26 <rdar://problem/11538779> Fixing issues where Python scripts were not able to read user input and/or display output to the user in certain situations - This fix introduces a Python InputReader manager class that mimics the behavior of the interactive interpreter in terms of access to I/O and ensures access to the input and output flows
llvm-svn: 158124
2012-06-07 00:17:18 +00:00
Johnny Chen 89b639e9a8 Update wording for the member field m_error.
llvm-svn: 158095
2012-06-06 19:01:20 +00:00
Jim Ingham ef42a6fb1d Add the SBWatchpoint::GetError back, we have clients who use it.
llvm-svn: 158092
2012-06-06 18:46:25 +00:00
Jim Ingham aacc31813e Make sure that when if we are going to Halt while the process is in the middle of HandlePrivateEvent we
wait till that is done.  We need a stronger way to do this, but in practice this works and using some locking
strategy is harder because Halt & HandlePrivateEvent generally happen on different threads.

llvm-svn: 158042
2012-06-06 00:29:30 +00:00
Johnny Chen c4392d2ad0 rdar://problem/11598332
The output of 'register read' should be prettier.
Modify RegisterValue::Dump() to take an additional parameter:

    uint32_t reg_name_right_align_at

which defaults to 0 (i.e., no alignment at all).  Update the 'register read' command impl to pass 8
as the alignment to RegisterValue::Dump() method.  If more sophisticated scheme is desired, we will
need to introduce an additional command option to 'register read' later on.

llvm-svn: 158039
2012-06-05 23:25:10 +00:00
Jim Ingham 41ec0f9018 Whitespace cleanup.
llvm-svn: 158032
2012-06-05 22:53:34 +00:00
Johnny Chen 3f476c4a72 rdar://problem/11597911
Fix confusing error message about "expression did not evaluate to an address" when doing 'watchpoint set expression".
Instead of using 0 as the fail_value when invoking ValueObject::GetValueAsUnsigned(), modify the API to take an addition
bool pointer (defaults to NULL) to indicate success/failure of value conversion.

llvm-svn: 158016
2012-06-05 19:37:43 +00:00
Johnny Chen d3761a7e10 Cannot break the existing API client of SBValue::Watch(bool resolve_location, bool read, bool write).
Leave this method in the codebase for a while.

llvm-svn: 157967
2012-06-04 23:45:50 +00:00
Johnny Chen b90827e66c rdar://problem/11584012
Refactorings of watchpoint creation APIs so that SBTarget::WatchAddress(), SBValue::Watch(), and SBValue::WatchPointee()
now take an additional 'SBError &error' parameter (at the end) to contain the reason if there is some failure in the
operation.  Update 'watchpoint set variable/expression' commands to take advantage of that.

Update existing test cases to reflect the API change and add test cases to verify that the SBError mechanism works for
SBTarget::WatchAddress() by passing an invalid watch_size.

llvm-svn: 157964
2012-06-04 23:19:54 +00:00
Johnny Chen 3cb41e82cb Give more explicit error messages when watchpoint creation command (watchpoint set) fails,
like number of supported hardware watchpoints reached or the watch size is not allowed.

llvm-svn: 157948
2012-06-04 20:08:23 +00:00
Jim Ingham b4451b1730 When the Platform launches a process for debugging, make sure it goes into a separate process group, otherwise ^C will both cause us to try to Stop it manually, AND send it a SIGINT, which can confuse us.
rdar://problem/11369230

llvm-svn: 157791
2012-06-01 01:22:13 +00:00
Enrico Granata 5f5ab60274 <rdar://problem/11328896> Fixing a bug where regex commands were saved in the history even if they came from a 'command sourced' file - this fix introduces a command sourcing depth and disables history for all levels of depth > 0, which means no commands go into history when being sourced from a file. we need an integer depth because command files might themselves source other command files, ...
llvm-svn: 157727
2012-05-31 01:09:06 +00:00
Jim Ingham 3ee12ef26e We were accessing the ModuleList in the target without locking it for tasks like
setting breakpoints.  That's dangerous, since while we are setting a breakpoint,
the target might hit the dyld load notification, and start removing modules from
the list.  This change adds a GetMutex accessor to the ModuleList class, and
uses it whenever we are accessing the target's ModuleList (as returned by GetImages().)

<rdar://problem/11552372>

llvm-svn: 157668
2012-05-30 02:19:25 +00:00
Johnny Chen 797a1b37e5 Fix arch_helper() to return the list of supported architectures.
llvm-svn: 157643
2012-05-29 20:04:10 +00:00
Greg Clayton d70b14ea9d Fixed memory management issues introduced by revision 157507.
A local std::string was being filled in and then the function would return "s.c_str()".
A local StreamString (which contains a std::string) was being filled in, and essentially also returning the c string from the std::string, though it was in a the StreamString class.

The fix was to not do this by passing a stream object into StringList::Join() and fix the "arch_helper()" function to do what it should: cache the result in a global.

llvm-svn: 157519
2012-05-26 17:21:14 +00:00
Johnny Chen ca7835c685 rdar://problem/11535045
Make 'help arch' return the list of supported architectures.
Add a convenience method StringList::Join(const char *separator) which is called from the help function for 'arch'.
Also add a simple test case.

llvm-svn: 157507
2012-05-26 00:32:39 +00:00
Greg Clayton 57f0630cc5 <rdar://problem/11534686>
Reading memory from a file when the section is encrypted doesn't show an error. No we do.

llvm-svn: 157484
2012-05-25 17:05:55 +00:00
Johnny Chen a95ce623d8 rdar://problem/11457634
Supports the use-case scenario of immediately continuing the process once attached.
Add a simple completion test case from "process attach --con" to "process attach --continue ".

llvm-svn: 157361
2012-05-24 00:43:00 +00:00
Johnny Chen f9ef60d236 Add SBProcess::GetNumSupportedHardwareWatchpoints() API and export it through the Python scripting bridge.
Add/modify some test cases.

llvm-svn: 157353
2012-05-23 22:34:34 +00:00
Johnny Chen 6463720505 Add the capability to display the number of supported hardware watchpoints to the "watchpoint list" command.
Add default Process::GetWatchpointSupportInfo() impl which returns an error of "not supported".
Add "qWatchpointSupportInfo" packet to the gdb communication layer to support this, and modify TestWatchpointCommands.py to test it.

llvm-svn: 157345
2012-05-23 21:09:52 +00:00
Filipe Cabecinhas fccc829ce7 Remove trailing semicolons.
llvm-svn: 157240
2012-05-22 08:36:18 +00:00
Jim Ingham a8558b6289 Also push file & line breakpoints past the prologue. Also added a "-K" argument to the relevant
"break set" commands to set this per breakpoint.  Also, some CreateBreakpoint API's in the lldb_private
namespace had "internal" first and "skip_prologue" second.  "internal should always be last.  Fixed that.

rdar://problem/11484729

llvm-svn: 157225
2012-05-22 00:12:20 +00:00
Sean Callanan 0259e51287 Fixed a nasty bug where JIT expressions didn't work
when stopped in a const method.  Also updated our
testsuite to ensure that JIT is forced in this case.

llvm-svn: 157208
2012-05-21 21:29:52 +00:00
Enrico Granata fd4c84ee9f <rdar://problem/11355592> Fixing a bug where we would incorrectly try and determine a dynamic type for a variable of a pointer type that is not a valid generic type for dynamic pointers.
llvm-svn: 157190
2012-05-21 16:51:35 +00:00
Filipe Cabecinhas 721ba3ff77 Fixes the case where we created a dummy target, deleted it, and then tried to evaluate an expression with no target.
llvm-svn: 157110
2012-05-19 09:59:08 +00:00
Greg Clayton 4c82d425fa Found a quick way to improve the speed with which we can read object files from memory when they are in the shared cache: always read the symbol table strings from memory and let the process' memory cache do the work.
llvm-svn: 157083
2012-05-18 23:20:01 +00:00
Greg Clayton fa559e5c6e <rdar://problem/11386214>
<rdar://problem/11455913>

"target symbol add" should flush the cached frames
"register write" should flush the thread state in case registers modifications change stack

 

llvm-svn: 157042
2012-05-18 02:38:05 +00:00
Jim Ingham 4a94c91077 If we notice that a module with a given file path is replaced by another with the same file
path on rerunning, evict the old module from the target module list, inform the breakpoints
about this so they can do something intelligent as well.

rdar://problem/11273043

llvm-svn: 157008
2012-05-17 18:38:42 +00:00
Jim Ingham b08a9442fd Add an accessor on SBBreakpointLocation to get its location ID.
llvm-svn: 156891
2012-05-16 00:51:15 +00:00
Jason Molenda 7a9a72b423 Add LLDB_DISABLE_PYTHON around newly added methods in
DataVisualization.h / DataVisualization.cpp / ValueObject.cpp
and
FormatManager.h / FormatManager.cpp

llvm-svn: 156886
2012-05-16 00:38:08 +00:00
Greg Clayton 0d69a3a4b3 <rdar://problem/11246147>
Make sure our debugger STDIN read thread shuts down quickly when we are done with it. We had a case where the owner of the file handle was not closing it and caused spins.

llvm-svn: 156879
2012-05-16 00:11:54 +00:00
Johnny Chen 6ebc8c4598 Include llvm/ADT/STLExtras.h from lldb/Utility/Utils.h and use llvm::array_lengthof(), instead.
llvm-svn: 156876
2012-05-15 23:21:36 +00:00
Greg Clayton aafa5c9ecd Modified "image lookup -t <typename>" to expand typedefs.
llvm-svn: 156845
2012-05-15 19:26:12 +00:00
Greg Clayton 4116e93dc5 <rdar://problem/11240464>
Correctly unique a class' methods when we detect that a class has been uniqued to another.

llvm-svn: 156795
2012-05-15 02:33:01 +00:00
Jim Ingham 7ba6e99158 Found one more place where the OkayToDiscard needs to be consulted.
Also changed the defaults for SBThread::Step* to not delete extant plans.
Also added some test cases to test more complex stepping scenarios.

llvm-svn: 156667
2012-05-11 23:47:32 +00:00
Jim Ingham 923886ce2c Don't try to use "OkayToDiscard" to mean BOTH this plan is a user plan or not AND unwind on error.
rdar://problem/11419156

llvm-svn: 156627
2012-05-11 18:43:38 +00:00
Greg Clayton ba812f4284 <rdar://problem/11330621>
Fixed the DisassemblerLLVMC disassembler to parse more efficiently instead of parsing opcodes over and over. The InstructionLLVMC class now only reads the opcode in the InstructionLLVMC::Decode function. This can be done very efficiently for ARM and architectures that have fixed opcode sizes. For x64 it still calls the disassembler to get the byte size.

Moved the lldb_private::Instruction::Dump(...) function up into the lldb_private::Instruction class and it now uses the function that gets the mnemonic, operandes and comments so that all disassembly is using the same code.

Added StreamString::FillLastLineToColumn() to allow filling a line up to a column with a character (which is used by the lldb_private::Instruction::Dump(...) function).

Modified the Opcode::GetData() fucntion to "do the right thing" for thumb instructions.

llvm-svn: 156532
2012-05-10 02:52:23 +00:00
Jim Ingham 18de2fdc55 If the ObjC Step Through Trampoline plan causes a target crash, properly propagate the error back to
the controlling plans so that they don't lose control.

Also change "ThreadPlanStepThrough" to take the return StackID for its backstop breakpoint as an argument
to the constructor rather than having it try to figure it out itself, since it might get it wrong whereas
the caller always knows where it is coming from.

rdar://problem/11402287

llvm-svn: 156529
2012-05-10 01:35:39 +00:00
Jim Ingham 8499e1a4cb Print out a notification when the process of a target other than the currently selected target stops.
llvm-svn: 156433
2012-05-08 23:06:07 +00:00
Enrico Granata a777dc2abe <rdar://problem/11338654> Fixing a bug where having a summary for a bitfield without a format specified would in certain cases crash LLDB - This has also led to refactoring the by-type accessors for the data formatter subsystem. These now belong in our internal layer, and are just invoked by the public API stratum
llvm-svn: 156429
2012-05-08 21:49:57 +00:00
Enrico Granata 07a4ac22ed <rdar://problem/11239650> Fixing a bug where the SetValueFromCString() method failed to operate on dynamic values. The fix consists in making the set operation fall through to the parent. We only actually allow this if the dynamic value is at a 0-offset from the parent, or the new value is 0. Other scenarios would need agreement on the actual meaning of the set operation (do we keep offsetting? do we just assume the user knows what they are doing?) so we prevent them, and let the expression parser deal with the complexity
llvm-svn: 156422
2012-05-08 21:25:06 +00:00
Enrico Granata 601ccb583f Removing spurious friend declaration
llvm-svn: 156398
2012-05-08 18:49:36 +00:00
Enrico Granata 886147f0ac First part of a fix to make GetNonSyntheticValue() work correctly
llvm-svn: 156397
2012-05-08 18:47:08 +00:00
Greg Clayton 7051231709 <rdar://problem/11358639>
Switch over to the "*-apple-macosx" for desktop and "*-apple-ios" for iOS triples.

Also make the selection process for auto selecting platforms based off of an arch much better.

llvm-svn: 156354
2012-05-08 01:45:38 +00:00
Johnny Chen 4ab2e6be38 Updated to a more meaningful macro name.
llvm-svn: 156340
2012-05-07 23:23:41 +00:00
Johnny Chen 5ec8fcbf0c Fix the problem that 'help breakpoint set' is printing a lot of redundant lines.
Correctly specify the LLDB_OPT_SET's that the 'shlib' command option belongs to by using a newly added macro like this:

    #define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM(1, 10) & ~LLDB_OPT_SET_10 )

rdar://problem/11393864

llvm-svn: 156337
2012-05-07 23:04:49 +00:00
Jim Ingham 444717b318 Missed a few uses of Mutex::GetMutex in template functions that don't seem to get instantiated on the Mac OS X build,
but were causing build failures on Linux.

llvm-svn: 156224
2012-05-04 23:54:57 +00:00
Jim Ingham 10ebffa48a Don't expose the pthread_mutex_t underlying the Mutex & Mutex::Locker classes.
No one was using it and Locker(pthread_mutex_t *) immediately asserts for 
pthread_mutex_t's that don't come from a Mutex anyway.  Rather than try to make
that work, we should maintain the Mutex abstraction and not pass around the
platform implementation...

Make Mutex::Locker::Lock take a Mutex & or a Mutex *, and remove the constructor
taking a pthread_mutex_t *.  You no longer need to call Mutex::GetMutex to pass
your mutex to a Locker (you can't in fact, since I made it private.)

llvm-svn: 156221
2012-05-04 23:02:50 +00:00
Jim Ingham 64e7ead1d8 Clean up the usage of "MasterPlan" status in ThreadPlans. Only user-initiated plans
should be MasterPlans that want to stay on the plan stack.  So make all plans NOT
MasterPlans by default and then have the SB API's and the CommandObjectThread step
commands set this explicitly.

Also added a "clean up" phase to the Thread::ShouldStop so that if plans get stranded
on the stack, we can remove them.  This is done by adding an IsPlanStale method to the
thread plans, and if the plan can know that it is no longer relevant, it returns true,
and the plan and its sub-plans will get discarded.

llvm-svn: 156101
2012-05-03 21:19:36 +00:00
Enrico Granata 78453eed12 Adding a new 'type category disable *' feature that disables all categories - This is intended as a quick kill switch for data formatters for cases where the user wants as little extra processing as possible to be done on their target, or to override major data formatters bug, should they occur
llvm-svn: 156044
2012-05-03 01:08:44 +00:00
Jim Ingham 92e1cd431c Cleanup - removing the ThreadPlanTestCondition and its helper functions. It is not needed,
since we now run the condition in the StopInfoBreakpoint's PerformAction, and don't need
to refer it to another "continue".  Actually, we haven't needed to do this for a year or
so, I just hadn't gotten around to deleting the dead wood.

llvm-svn: 155967
2012-05-02 00:23:18 +00:00
Jim Ingham fbbfe6ecf0 Fix reporting of stop reasons when the StepOver & StepIn plans stop because of a crash or breakpoint. Added the ability for a plan to say it is done but doesn't want to be the reason for the stop.
llvm-svn: 155927
2012-05-01 18:38:37 +00:00
Jim Ingham 57190baa6c Don't call SBDebugger::SetInternalVariable in the sigwinch_handler, since that takes locks and potentially does allocations.
Just call SBDebugger::SetTerminalWidth on the driver's SBDebugger, which does the same job, but no locks.
Also add the value checking to SetTerminalWidth you get with SetInternalVariable(..., "term-width", ...).

rdar://problem/11310563

llvm-svn: 155665
2012-04-26 21:39:32 +00:00
Greg Clayton 9efa076aa6 Save more memory by not parsing the symbol table for stand alone DWARF files. We currently have SymbolFile plug-ins which all get the chance to say what they can parse in a symbol file. Prior to this fix we would ask the SymbolFileDWARF plug-in what abilities it had, and it would answer with "everything", and then we would check the SymbolFileSymtab plug-in what abilities it had, in case it had more abilities. The checking that SymbolFileSymtab does is a bit expensive as it pulls in the entire symbol table just to see if it can offer a few scraps of debug information. This causes all stand along DWARF files to pull in their symbol tables even though those symbols will never be used. This fix will check all SymbolFile plug-ins for their abilities and if any plug-in responds with "everything", then we stop the search.
llvm-svn: 155638
2012-04-26 16:53:42 +00:00
Greg Clayton da91b17bc7 Patch from Viktor Kutuzov: changes the method declarations to const for the Args::GetCommandString and Agrs::GetQuotedCommandString methods. It allows using of these methods within the other const methods.
llvm-svn: 155593
2012-04-25 22:30:32 +00:00
Enrico Granata bce6b17d7a Fixing a typo in the previous commit that broke the build
llvm-svn: 155497
2012-04-24 22:33:23 +00:00
Enrico Granata 9f1e204130 Fixing an issue where the expression parser was not correctly freeze-drying bitfields - This patch ensures that (a) freeze-drying bitfields works correctly and (b) that we actually access bitfields through IR instead of the 'frame var en lieu of expr' shortcut, for added safety in corner cases that may arise
llvm-svn: 155494
2012-04-24 22:15:37 +00:00
Greg Clayton d61c0fc049 Added the ability to log a message with a backtrace when verbose logging is enabled to the Module class. Used this new function in the DWARF parser.
llvm-svn: 155404
2012-04-23 22:55:20 +00:00
Greg Clayton b210aec64d Added the ability to specify the symbol file for a module when adding it to a target.
llvm-svn: 155384
2012-04-23 20:23:39 +00:00
Jim Ingham 6d66ce67d7 Make sure the "synchronous breakpoint callbacks" get called before the thread plan logic gets invoked, and if they
ask to continue that should short-circuit the thread plans for that thread.  Also add a bit more explanation for
how this machinery is supposed to work.  
Also pass eExecutionPolicyOnlyWhenNeeded, not eExecutionPolicyAlways when evaluating the expression for breakpoint
conditions.

llvm-svn: 155236
2012-04-20 21:16:56 +00:00
Jim Ingham 3b8285d90d Switch to setting the write side of the run lock when we call Resume. Then make a PrivateResume that doesn't switch the run-lock state, and use that where we are resuming without changing the public resume state.
llvm-svn: 155092
2012-04-19 01:40:33 +00:00
Jim Ingham fd29c36fbf Add a WriteTryLock function.
llvm-svn: 155080
2012-04-19 00:19:47 +00:00
Sean Callanan ad880767fc We now record metadata for Objective-C interfaces,
Objective-C methods, and Objective-C properties.

llvm-svn: 154972
2012-04-18 01:06:17 +00:00
Greg Clayton 1e8ac36b60 Fixed the ability to load multiple __LINKEDIT segments at the same address for darwin shared cache entries. Now when registering the load address of a section, the DynamicLoader objects can specify if they should warn or not. This will fix the ability to load the nlist entries for shared libraries in the darwin shared caches when no on disk representation is available for a shared library.
llvm-svn: 154860
2012-04-16 21:01:30 +00:00
Greg Clayton d1cf11a74d Added a new host function that allows us to run shell command and get the output from them along with the status and signal:
Error
Host::RunShellCommand (const char *command,
                       const char *working_dir,
                       int *status_ptr,
                       int *signo_ptr,
                       std::string *command_output_ptr,
                       uint32_t timeout_sec);

This will allow us to use this functionality in the host lldb_private::Platform, and also use it in our lldb-platform binary. It leverages the existing code in Host::LaunchProcess and ProcessLaunchInfo.

llvm-svn: 154730
2012-04-14 01:42:46 +00:00
Jim Ingham 0092c8eb2f Factor out a bunch of common code in the two ThreadPlanCallFunction constructors. Also add a sanity check - try reading the frame, and if we fail bag out.
llvm-svn: 154698
2012-04-13 20:38:13 +00:00
Sean Callanan 60217120b5 Added a mechanism for keeping track of where in
the debug information individual Decls came from.

We've had a metadata infrastructure for a while,
which was intended to solve a problem we've since
dealt with in a different way.  (It was meant to
keep track of which definition of an Objective-C
class was the "true" definition, but we now find
it by searching the symbols for the class symbol.)
The metadata is attached to the ExternalASTSource,
which means it has a one-to-one correspondence with
AST contexts.

I've repurposed the metadata infrastructure to
hold the object file and DIE offset for the DWARF
information corresponding to a Decl.  There are
methods in ClangASTContext that get and set this
metadata, and the ClangASTImporter is capable of
tracking down the metadata for Decls that have been
copied out of the debug information into the
parser's AST context without using any additional
memory.

To see the metadata, you just have to enable the
expression log:
-
(lldb) log enable lldb expr
-
and watch the import messages.  The high 32 bits
of the metadata indicate the index of the object
file in its containing DWARFDebugMap; I have also
added a log which you can use to track that mapping:
-
(lldb) log enable dwarf map
-

This adds 64 bits per Decl, which in my testing
hasn't turned out to be very much (debugging Clang
produces around 6500 Decls in my tests).  To track
how much data is being consumed, I've also added a
global variable g_TotalSizeOfMetadata which tracks
the total number of Decls that have metadata in all
active AST contexts.

Right now this metadata is enormously useful for
tracking down bugs in the debug info parser.  In the
future I also want to use this information to provide
more intelligent error messages instead of printing
empty source lines wherever Clang refers to the
location where something is defined.

llvm-svn: 154634
2012-04-13 00:10:03 +00:00
Greg Clayton c8e0c244e4 Expose GetAddressClass() from both the SBAddress and SBInstruction so clients can tell the difference between ARM/Thumb opcodes when disassembling ARM.
llvm-svn: 154633
2012-04-13 00:07:34 +00:00