Commit Graph

3467 Commits

Author SHA1 Message Date
Greg Clayton 6535dae3b7 Remove the "-feliminate-unused-debug-types" OTHER_CFLAGS.
llvm-svn: 140893
2011-09-30 22:08:47 +00:00
Johnny Chen 86268e4459 o lldbtest.py:
Add a keyword argument 'endstr' to TestBase.expect() method to assert that the output
will end with 'endstr'.

Add TestBase.switch_to_thread_with_stop_reason(stop_reason) to select the thread with
the stop reason = 'stop_reason' as the current thread.

o TestWatchLocation.py:

Modified to switch to the stopped thread with stop reason = watchpoint and to evaluate
an expression with expected output for stronger assertion.

llvm-svn: 140890
2011-09-30 21:48:35 +00:00
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
Johnny Chen 97b5083cd6 Add docstring to in_range() function residing in the lldb module.
llvm-svn: 140833
2011-09-30 00:49:02 +00:00
Johnny Chen 1887fce184 Fix extraneous import as a result of the last change.
llvm-svn: 140832
2011-09-30 00:46:24 +00:00
Johnny Chen c44e20cec0 Migrate the in_range(symbol, section) and symbol_iter(module, section) utility functions
from lldbutil.py to the lldb.py proper.  The in_range() function becomes a function in
the lldb module.  And the symbol_iter() function becomes a method within the SBModule
called symbol_in_section_iter().  Example:

        # Iterates the text section and prints each symbols within each sub-section.
        for subsec in text_sec:
            print INDENT + repr(subsec)
            for sym in exe_module.symbol_in_section_iter(subsec):
                print INDENT2 + repr(sym)
                print INDENT2 + 'symbol type: %s' % symbol_type_to_str(sym.GetType())

might produce this following output:

    [0x0000000100001780-0x0000000100001d5c) a.out.__TEXT.__text
        id = {0x00000004}, name = 'mask_access(MaskAction, unsigned int)', range = [0x00000001000017c0-0x0000000100001870)
        symbol type: code
        id = {0x00000008}, name = 'thread_func(void*)', range = [0x0000000100001870-0x00000001000019b0)
        symbol type: code
        id = {0x0000000c}, name = 'main', range = [0x00000001000019b0-0x0000000100001d5c)
        symbol type: code
        id = {0x00000023}, name = 'start', address = 0x0000000100001780
        symbol type: code
    [0x0000000100001d5c-0x0000000100001da4) a.out.__TEXT.__stubs
        id = {0x00000024}, name = '__stack_chk_fail', range = [0x0000000100001d5c-0x0000000100001d62)
        symbol type: trampoline
        id = {0x00000028}, name = 'exit', range = [0x0000000100001d62-0x0000000100001d68)
        symbol type: trampoline
        id = {0x00000029}, name = 'fflush', range = [0x0000000100001d68-0x0000000100001d6e)
        symbol type: trampoline
        id = {0x0000002a}, name = 'fgets', range = [0x0000000100001d6e-0x0000000100001d74)
        symbol type: trampoline
        id = {0x0000002b}, name = 'printf', range = [0x0000000100001d74-0x0000000100001d7a)
        symbol type: trampoline
        id = {0x0000002c}, name = 'pthread_create', range = [0x0000000100001d7a-0x0000000100001d80)
        symbol type: trampoline
        id = {0x0000002d}, name = 'pthread_join', range = [0x0000000100001d80-0x0000000100001d86)
        symbol type: trampoline
        id = {0x0000002e}, name = 'pthread_mutex_lock', range = [0x0000000100001d86-0x0000000100001d8c)
        symbol type: trampoline
        id = {0x0000002f}, name = 'pthread_mutex_unlock', range = [0x0000000100001d8c-0x0000000100001d92)
        symbol type: trampoline
        id = {0x00000030}, name = 'rand', range = [0x0000000100001d92-0x0000000100001d98)
        symbol type: trampoline
        id = {0x00000031}, name = 'strtoul', range = [0x0000000100001d98-0x0000000100001d9e)
        symbol type: trampoline
        id = {0x00000032}, name = 'usleep', range = [0x0000000100001d9e-0x0000000100001da4)
        symbol type: trampoline
    [0x0000000100001da4-0x0000000100001e2c) a.out.__TEXT.__stub_helper
    [0x0000000100001e2c-0x0000000100001f10) a.out.__TEXT.__cstring
    [0x0000000100001f10-0x0000000100001f68) a.out.__TEXT.__unwind_info
    [0x0000000100001f68-0x0000000100001ff8) a.out.__TEXT.__eh_frame

llvm-svn: 140830
2011-09-30 00:42:49 +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
Johnny Chen a9b68f4dd6 Modify the delegation chain from MachThreadList -> MachThread -> DNBArchProtocol so that when
the watchpoint state is changed, not only does the change propagate to all the thread instances,
it also updates a global debug state, if chosen by the DNBArchProtocol derivative.

Once implemented, the DNBArchProtocol derivative, also makes sure that when new thread comes along,
it tries to inherit from the global debug state, if it is valid.

Modify TestWatchpointMultipleThreads.py to test this functionality.

llvm-svn: 140811
2011-09-29 21:48:52 +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
Johnny Chen 825ea37835 Fix a bug in the current MacOSX MachThreadList::EnableHardwareWatchpoint() impl so that
it enables the hardware watchpoint for all existing threads.  Add a test file for that.
Also fix MachThreadList::DisableHardwareWatchpoint().

llvm-svn: 140757
2011-09-29 01:20:42 +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
Johnny Chen c0f53df8ff Modify lldbutil.in_range(symbol, section) to deal with the symbol whose
end address is an LLDB_INVALID_ADDRESS.  Modify the test case to dump
all the symbols in all the sections.

llvm-svn: 140710
2011-09-28 18:33:50 +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
Johnny Chen a32a13d207 Add a test sequence of iterating through a module's symbols belonging to a section.
Add the relevant utility functions to the lldbutil.py file.

llvm-svn: 140669
2011-09-28 00:51:00 +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 b2c7825515 Add a simple test TestModuleAndSection.py to exercise some module/section-related APIs.
In particular, it iterates through the executable module's SBSections, looking for the
'__TEXT' section and further iterates on its subsections (of SBSection type, too).

llvm-svn: 140654
2011-09-27 23:15:58 +00:00
Johnny Chen 0f2ed0e5df Make the assignment of TestBase.mydir more portable.
llvm-svn: 140640
2011-09-27 21:49:34 +00:00
Johnny Chen 469683e98d SBWatchpointLocation.GetDescription() takes an additional description level arg.
Modify get_description() utility function in lldbutil.py to handle that.

llvm-svn: 140638
2011-09-27 21:27:19 +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
Johnny Chen 4e6a4fa899 Add fuzz testing for newly added SBWatchpointLocation API.
llvm-svn: 140632
2011-09-27 20:23:43 +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
Greg Clayton e241bad92b Enable the following CFLAGS in the Xcode project build:
-flimit-debug-info -feliminate-unused-debug-types -Wparentheses

This helps to trim down the debug information size a bit by omitting types
that aren't used.

llvm-svn: 140611
2011-09-27 17:26:03 +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
Sean Callanan 01ea1a618d Fixed an include path that was breaking Linux builds.
llvm-svn: 140577
2011-09-26 23:01:39 +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
Greg Clayton a6e429217f Fixes for a few different versions of the darwin crash log.
llvm-svn: 140554
2011-09-26 19:17:49 +00:00
Johnny Chen 7da349d3a1 Remove the @expectedFailureClang custom decorator for indicating clang-specific test failures.
It has been fixed on the lldb side to compensate for bad debug info (line table information).

llvm-svn: 140550
2011-09-26 19:05:08 +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
Greg Clayton 2f9ca7b1f5 Added an example that symbolicates symbol information. This file
is mostly geared towards darwin crash logs at the moment, though
it could be made more generic with a few tweaks. 

The symbolicate-crash.py script will make a target given a crash log
and then symbolicate all frames and expand any frames that had inlined
functions in them to show all frames back to the concrete function. It
will also disassemble around the crash site.

llvm-svn: 140544
2011-09-26 18:39:23 +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
Johnny Chen 57087f3df3 Fix comment.
llvm-svn: 140450
2011-09-24 05:01:53 +00:00
Johnny Chen 5b94dc28b3 SBSection supports iteration through its subsections, represented as SBSection as well.
SBModule supports an additional SBSection iteration, besides the original SBSymbol iteration.
Add docstrings and implement the two SBSection iteration protocols.

llvm-svn: 140449
2011-09-24 04:51:43 +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
Greg Clayton 64a4eaae06 Added missing file.
llvm-svn: 140442
2011-09-24 01:32:22 +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