Commit Graph

1970 Commits

Author SHA1 Message Date
Greg Clayton 0bd4e1b8c9 Removed some commented out code from the DWARF parser.
Also reduce the size of the lldb_private::Symbol objects by removing the
lldb_private::Function pointer that was in each symbol. Running Instruments
has shown that when debugging large applications with DWARF in .o files that
lldb_private::Symbol objects are one of the highest users of memory. No one
was using the Symbol::GetFunction() call anyway.

llvm-svn: 140881
2011-09-30 20:52:25 +00:00
Greg Clayton 3360b411a5 Destroy a target when it is deleted.
llvm-svn: 140845
2011-09-30 04:14:52 +00:00
Greg Clayton 753406221b After deleting a target, clear the target object and remove orphaned modules.
llvm-svn: 140843
2011-09-30 03:29:05 +00:00
Greg Clayton 2bc22f83ad <rdar://problem/10212450>
Don't parse function types all the time, only parse them lazily.

llvm-svn: 140842
2011-09-30 03:20:47 +00:00
Johnny Chen b62a3be1a2 Add an accompanying option to the 'frame variable -w' command to, instead of watching the variable,
watch the location pointed to by the variable.  An example,

(lldb) frame variable -w write -x 1 -g g_char_ptr
(char *) g_char_ptr = 0x0000000100100860 ""...
Watchpoint created: WatchpointLocation 1: addr = 0x100100860 size = 1 state = enabled type = w
    declare @ '/Volumes/data/lldb/svn/trunk/test/functionalities/watchpoint/hello_watchlocation/main.cpp:21'

...

(lldb) c
Process 3936 resuming

...

rocess 3936 stopped
* thread #2: tid = 0x3403, 0x00000001000009b7 a.out`do_bad_thing_with_location(char*, char) + 23 at main.cpp:27, stop reason = watchpoint 1
    frame #0: 0x00000001000009b7 a.out`do_bad_thing_with_location(char*, char) + 23 at main.cpp:27
   24  	do_bad_thing_with_location(char *char_ptr, char new_val)
   25  	{
   26  	    *char_ptr = new_val;
-> 27  	}
   28  	
   29  	uint32_t access_pool (uint32_t flag = 0);
   30  	
(lldb) 

Also add TestWatchLocation.py test to exercise this functionality.

llvm-svn: 140836
2011-09-30 01:08:48 +00:00
Jim Ingham 2af4db5835 Remember to mark the OptionValueUUID as set in SetOptionValue.
llvm-svn: 140835
2011-09-30 01:05:23 +00:00
Greg Clayton 6c7f56192f Fixed an issue where a lexical block or inlined function might have bad debug
information generated for it. Say we have a concrete function "foo" which
has inlined function "a" which calls another inlined function "b":

    foo
1   {
2       {
            a ()
3           {
                b ()
4               {
                
                }
            }
        }
    }
    
Sometimes we see the compiler generate an address range in the DWARF for "foo"
(block 1 above) as say [0x1000-0x1100). Then the range for "a" is something
like [0x1050-0x1060) (note that it is correctly scoped within the "foo" 
address range). And then we get "b" which is a child of "a", yet the debug
info says it has a range of [0x1060-0x1080) (not contained within "a"). We now
detect this issue when making our blocks and add an extra range to "a".

Also added a new "lldb" logging category named "symbol" where we can find out
about symbol file errors and warnings.

llvm-svn: 140822
2011-09-29 23:41:34 +00:00
Jason Molenda 82d4a2b91f Add an additional "frame select" usage where it will re-select the current frame
if no frame is specified.  This is useful to get the source context lines re-displayed
when you need a reminder of where you are in the source currently.

llvm-svn: 140819
2011-09-29 23:02:41 +00:00
Jason Molenda 560183fd2d Fix verbose logging of unwinders.
llvm-svn: 140817
2011-09-29 22:34:41 +00:00
Jim Ingham c1663048e0 Centralize the warning reporting and use ReportWarning & ReportError everywhere we were using fprintf(stderr directly.
llvm-svn: 140813
2011-09-29 22:12:35 +00:00
Greg Clayton 624784a987 Free up some space in lldb_private::Block by not requiring a sibling pointer.
The old way of storing blocks used to use the sibling pointer, but now all
blocks contain a collection of shared pointers to blocks so this isn't required
anymore and a parent can be asked to find the sibling block for a child block.

llvm-svn: 140808
2011-09-29 21:19:25 +00:00
Jim Ingham 6626447929 Missed one place where we should use the target's SourceManager, not the debugger's.
llvm-svn: 140804
2011-09-29 20:22:33 +00:00
Greg Clayton 4d01ace4fd If the new .apple_names and .apple_types DWARF accelerator tables
are available, we currently will still index the DWARF ourselves
and assert if the name lookups differ. This will help us transition
to the new accelerator tables and make sure they are workng before
we switch over entirely.

llvm-svn: 140788
2011-09-29 16:58:15 +00:00
Greg Clayton 2ed2b6bb44 Found a great optimization after speaking with Sean Callanan which cleans
up the implementation details of the on disk hash, these changed implement
the changes in the on disk table format.

llvm-svn: 140750
2011-09-29 00:58:11 +00:00
Johnny Chen 586e8ea46f Fix help string for "frame variable".
llvm-svn: 140714
2011-09-28 19:41:18 +00:00
Greg Clayton 1767440a72 Convert over to the latest and greatest on disc accelerator
hash tables. Renamed the DWARF sections to ".apple_names" and
".apple_types" until we get more buy in from other vendors.

llvm-svn: 140702
2011-09-28 17:06:40 +00:00
Jim Ingham 32adcb2e8f Need to go to the containing inline block to get the inline name right.
llvm-svn: 140662
2011-09-27 23:59:35 +00:00
Johnny Chen 9d954d8665 Add SBTarget::GetLastCreatedWatchpointLocation() API and export to the Python interface.
Also add rich comparison methods (__eq__ and __ne__) for SBWatchpointLocation.
Modify TestWatchpointLocationIter.py to exercise the new APIs.

Add fuzz testings for the recently added SBTarget APIs related to watchpoint manipulations.

llvm-svn: 140633
2011-09-27 20:29:45 +00:00
Jim Ingham 530a413c7b Added an API to SymbolContext to hide the complexity of getting the
function name from a symbol context.  Use that in CommandCompletions
to get the right name.

llvm-svn: 140628
2011-09-27 19:48:20 +00:00
Johnny Chen d4dd7993b5 Export the watchpoint related API (SBWatchpointLocation class and added SBTarget methods)
to the Python interface.

Implement yet another (threre're 3 now) iterator protocol for SBTarget: watchpoint_location_iter(),
to iterate on the available watchpoint locations.  And add a print representation for
SBWatchpointLocation.

Exercise some of these Python API with TestWatchpointLocationIter.py.

llvm-svn: 140595
2011-09-27 01:19:20 +00:00
Greg Clayton fb0655ef59 Fixed the public and internal disassembler API to be named correctly:
const char *
SBInstruction::GetMnemonic()

const char *
SBInstruction::GetOperands()

const char *
SBInstruction::GetComment()

Fixed the symbolicate example script and the internals.

llvm-svn: 140591
2011-09-27 00:58:45 +00:00
Johnny Chen 5d0434644c Add SB API class SBWatchpointLocation and some extra methods to the SBTarget class to
iterate on the available watchpoint locations and to perform watchpoint manipulations.

I still need to export the SBWatchpointLocation class as well as the added watchpoint
manipulation methods to the Python interface.  And write test cases for them.

llvm-svn: 140575
2011-09-26 22:40:50 +00:00
Sean Callanan 9bc838415e Factored out handling of the source code for an
expression into a separate class.  This class
encapsulates wrapping the function as needed.  I
am also moving from using booleans to indicate
what the expression's language should be to using
lldb::LanguageType instead.

llvm-svn: 140545
2011-09-26 18:45:31 +00:00
Johnny Chen 7aa043afd9 Modify SBFrame::WatchValue() impl so that for the watchpoint location created,
it also populates the variable declaration location if possible.

llvm-svn: 140540
2011-09-26 18:05:16 +00:00
Greg Clayton 8f7180b11e Added more functionality to the public API to allow for better
symbolication. Also improved the SBInstruction API to allow
access to the instruction opcode name, mnemonics, comment and
instruction data.

Added the ability to edit SBLineEntry objects (change the file,
line and column), and also allow SBSymbolContext objects to be
modified (set module, comp unit, function, block, line entry
or symbol). 

The SymbolContext and SBSymbolContext can now generate inlined
call stack infomration for symbolication much easier using the
SymbolContext::GetParentInlinedFrameInfo(...) and 
SBSymbolContext::GetParentInlinedFrameInfo(...) methods.

llvm-svn: 140518
2011-09-26 07:11:27 +00:00
Greg Clayton d9dc52dc4c Added the ability to get all section contents, or the section
contents starting at an offset (2 separate methods). This helps
the scripting interface stay more natural by allowing both from
Python.

Added the ability to dump data with address annotations when
call SBData::GetDescription().

Hooked up the SBSection to the __repr__ so you can print section
objects from within python.

Improved the dumping of symbols from python.

Fixed the .i interface references which were set to "Relative to this Group"
which somehow included Jim's "lldb-clean" root directory in the path. The
interfaces are now in a folder called "interfaces" withing the Xcode API
subfolder.

llvm-svn: 140451
2011-09-24 05:04:40 +00:00
Jason Molenda 0ca4f8bb9e Adjust kext load messages in DynamicLoaderDarwinKernel::ParseKextSummaries so we
print result information if a kext fails to be located or loaded for some reason.

llvm-svn: 140447
2011-09-24 02:47:39 +00:00
Greg Clayton f644ddf429 Fixed build issues after recent checkin.
Added the ability to get the name of the SBSection.

llvm-svn: 140444
2011-09-24 01:37:21 +00:00
Jim Ingham 810bf85e8a Add GetAddress to SBBreakpointLocation, and put the .i files in the API section of the Xcode project.
llvm-svn: 140440
2011-09-24 01:04:57 +00:00
Greg Clayton cac9c5f971 Added to the public API to allow symbolication:
- New SBSection objects that are object file sections which can be accessed
  through the SBModule classes. You can get the number of sections, get a 
  section at index, and find a section by name.
- SBSections can contain subsections (first find "__TEXT" on darwin, then
  us the resulting SBSection to find "__text" sub section).
- Set load addresses for a SBSection in the SBTarget interface
- Set the load addresses of all SBSection in a SBModule in the SBTarget interface
- Add a new module the an existing target in the SBTarget interface
- Get a SBSection from a SBAddress object

This should get us a lot closer to being able to symbolicate using LLDB through
the public API.

llvm-svn: 140437
2011-09-24 00:52:29 +00:00
Johnny Chen 6027c94d2f Add an SB API SBFrame::WatchValue() and exported to the Python interface to
set a watchpoint Pythonically.  If the find-and-watch-a-variable operation
fails, an invalid SBValue is returned, instead.

Example Python usage:

        value = frame0.WatchValue('global',
                                  lldb.eValueTypeVariableGlobal,
                                  lldb.LLDB_WATCH_TYPE_READ|lldb.LLDB_WATCH_TYPE_WRITE)

Add TestSetWatchpoint.py to exercise this API.
We have 400 test cases now.

llvm-svn: 140436
2011-09-24 00:50:33 +00:00
Johnny Chen edf503757c Add a (bool)end_to_end parameter, default true, to the Target::Remove/Disable/EnableALLWatchpointLocations()
methods.  If passed as false, it signifies that only the debugger side is affected.

Modify Target::DeleteCurrentProcess() to use DisableAllWatchpointLocations(false) to
disable the watchpoint locations, instead of removing them between process instances.

llvm-svn: 140418
2011-09-23 21:21:43 +00:00
Jason Molenda effcd2aa70 in CommandObjectTargetStopHookList::Execute, if we don't have a target,
return before we try to dereference the target later in the function.
Currently,

% lldb -x
(lldb) target stop-hook list

crashes because of this.

llvm-svn: 140417
2011-09-23 21:15:42 +00:00
Jim Ingham 843bfb2c4e If stepping takes us from the line range we were stepping through into the MIDDLE of another line, then continue till we get to the real beginning of a line. This is mostly to work around debug information bugs.
llvm-svn: 140416
2011-09-23 21:08:11 +00:00
Jim Ingham 87df91b866 Added the ability to restrict breakpoints by function name, function regexp, selector
etc to specific source files.
Added SB API's to specify these source files & also more than one module.
Added an "exact" option to CompileUnit's FindLineEntry API.

llvm-svn: 140362
2011-09-23 00:54:11 +00:00
Jason Molenda 879cf77d12 Remove the Stop Hooks / End Stop Hooks lines before/after running
the stop-hooks.  I've been living on lldb with some stop-hooks
defined for the past week and the five extra lines of output on
every stop is really detracting from the usefulness of this feature.

llvm-svn: 140358
2011-09-23 00:42:55 +00:00
Jason Molenda 7f85299c1b LookupAddressInModule: Remove a couple of the extra
newlines output at the end of 'image lookup' / 'image lookup -v'.

llvm-svn: 140357
2011-09-23 00:27:44 +00:00
Johnny Chen de75346496 Watchpoint IDs and ID Ranges are not quite the same as Breakpoint IDs and ID Ranges.
Add eArgTypeWatchpointID and eArgTypeWatchpointIDRange to the CommandArgumentType enums and
modify the signature of CommandObject::AddIDsArgumentData() from:

    AddIDsArgumentData(CommandArgumentEntry &arg)

to:

    AddIDsArgumentData(CommandArgumentEntry &arg, CommandArgumentType ID, CommandArgumentType IDRange)

to accommodate.

llvm-svn: 140346
2011-09-22 22:34:09 +00:00
Johnny Chen f04ee930a0 Add initial implementation of watchpoint commands for list, enable, disable, and delete.
Test cases to be added later.

llvm-svn: 140322
2011-09-22 18:04:58 +00:00
Greg Clayton c14ee32db5 Converted the lldb_private::Process over to use the intrusive
shared pointers.

Changed the ExecutionContext over to use shared pointers for
the target, process, thread and frame since these objects can
easily go away at any time and any object that was holding onto
an ExecutionContext was running the risk of using a bad object.

Now that the shared pointers for target, process, thread and
frame are just a single pointer (they all use the instrusive
shared pointers) the execution context is much safer and still
the same size. 

Made the shared pointers in the the ExecutionContext class protected
and made accessors for all of the various ways to get at the pointers,
references, and shared pointers.

llvm-svn: 140298
2011-09-22 04:58:26 +00:00
Jason Molenda 1201723797 Fix printf call in SearchFilterByModuleList::GetDescription.
llvm-svn: 140289
2011-09-22 02:24:49 +00:00
Sean Callanan 0886e5657b Fixed a problem with the IR interpreter that caused
it to generate result variables that were not bound
to their underlying data.  This allowed the SBValue
class to use the interpreter (if possible).

Also made sure that any result variables that point
to stack allocations in the stack frame of the
interpreted expressions do not get live data.

llvm-svn: 140285
2011-09-22 00:41:11 +00:00
Johnny Chen fd158f411a StopInfoWatchpoint should override the StopInfo::ShouldStop() virtual method and delegate to
the WatchpointLocation object to check whether it should stop and allow it to update the hit
count, among other bookkeepings.

llvm-svn: 140279
2011-09-21 22:47:15 +00:00
Greg Clayton c1ef10f99e Fixed two printf format errors.
llvm-svn: 140239
2011-09-21 06:45:51 +00:00
Greg Clayton 593577a13a The first part of a fix for being able to select an architecture slice from
a file when the target has a triple with an unknown vendor and/or OS and the
slice of the file itself has a valid vendor and/or OS.

The Module now adopts the ObjectFile's architecture after a valid architecture
has been loaded to make sure the module matches the object file.

llvm-svn: 140236
2011-09-21 03:57:31 +00:00
Jim Ingham 969795f14b Add a new breakpoint type "break by source regular expression".
Fix the RegularExpression class so it has a real copy constructor.
Fix the breakpoint setting with multiple shared libraries so it makes
  one breakpoint not one per shared library.
Add SBFileSpecList, to be used to expose the above to the SB interface (not done yet.)

llvm-svn: 140225
2011-09-21 01:17:13 +00:00
Johnny Chen a3234732a0 Fix comment typo.
llvm-svn: 140222
2011-09-21 01:04:49 +00:00
Johnny Chen 184d7a727e A little refactoring of the way to add break IDs or ID ranges as command argument data
to the command argument entry.  Add a static helper function:

    CommandObject::AddIDsArgumentData(CommandArgumentEntry &arg)

to be used from CommandObjectBreakpoint.cpp.  The helper function could also be useful
for commands in the future to manipulate watchpoints.

llvm-svn: 140221
2011-09-21 01:00:02 +00:00
Johnny Chen 86364b4521 Add some watchpoint maintenance methods to the Target class.
Plus some minor changes to the WatchpointLocationList and WatchpointLocation classes.

llvm-svn: 140211
2011-09-20 23:28:55 +00:00
Jason Molenda ca0e3fa325 One last printf-style call cleanup.
llvm-svn: 140205
2011-09-20 23:23:44 +00:00