This patch initially was committed in r237460 but later it was reverted (r237479) due to 4 new failures:
* TestExitDuringStep.py
* TestNumThreads.py
* TestThreadExit.py
* TestThreadStates.py
This patch also fixes these tests.
llvm-svn: 237566
Summary:
This option forces to only set a source line breakpoint when there is an exact-match
This patch includes the following commits:
# Add the -m/--exact-match option in "breakpoint set" command
## Add exact_match arg in BreakpointResolverFileLine ctor
## Add m_exact_match field in BreakpointResolverFileLine
## Add exact_match arg in BreakpointResolverFileRegex ctor
## Add m_exact_match field in BreakpointResolverFileRegex
## Add exact_match arg in Target::CreateSourceRegexBreakpoint
## Add exact_match arg in Target::CreateBreakpoint
## Add -m/--exact-match option in "breakpoint set" command
# Add target.exact-match option to skip BP if source line doesn't match
## Add target.exact-match global option
## Add Target::GetExactMatch
## Refactor Target::CreateSourceRegexBreakpoint to accept LazyBool exact_match (was bool)
## Refactor Target::CreateBreakpoint to accept LazyBool exact_match (was bool)
# Add target.exact-match test in SettingsCommandTestCase
# Add BreakpointOptionsTestCase tests to test --skip-prologue/--exact-match options
# Fix a few typos in lldbutil.check_breakpoint_result func
# Rename --exact-match/m_exact_match/exact_match/GetExactMatch to --move-to-nearest-code/m_move_to_nearest_code/move_to_nearest_code/GetMoveToNearestCode
# Add exact_match field in BreakpointResolverFileLine::GetDescription and BreakpointResolverFileRegex::GetDescription, for example:
was:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, locations = 1, resolved = 1, hit count = 2
1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```
now:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, exact_match = 0, locations = 1, resolved = 1, hit count = 2
1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```
Test Plan:
./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/breakpoint/
./dotest.py -v --executable $BUILDDIR/bin/lldb settings/
./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/breakpoint/
Reviewers: jingham, clayborg
Reviewed By: clayborg
Subscribers: lldb-commits, clayborg, jingham
Differential Revision: http://reviews.llvm.org/D9273
llvm-svn: 237460
Summary:
Since we don't yet have remote windows debugging, it should be safe to assume
that the remote target uses unix path separators.
Reviewers: ovyalov, zturner, clayborg, vharron
Reviewed By: vharron
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9633
llvm-svn: 237006
- Test verifies LLDB's handling of inferiors with threads that: hit breakpoints,
modfiy variables that have watchpoints set, generate user signals, and crash.
- Add a few "stress tests" (with ~100 threads) -- run these with "-l" dotest.py
flag.
- Fix stop_reason_to_str helper in lldbutil to handle eStopReasonThreadExited.
- Add sort_stopped_threads helper to lldbutil to separate thread lists based
on stop reason.
Logged llvm.org/pr16566 and llvm.org/pr16567 for bugs exposed.
llvm-svn: 185889
This test is incorrect as functions that return lldb.SBThread objects never return None, they just return lldb.SBThread objects that contain invalid opaque classes.
llvm-svn: 177416
Setting breakpoints using "breakpoint set --selector <SEL>" previously didn't when there was no dSYM file.
Also fixed issues in the test suite that arose after fixing the bug.
Also fixed the log channels to properly ref count the log streams using weak pointers to the streams. This fixes a test suite problem that would happen when you specified a full path to the compiler with the "--compiler" option.
llvm-svn: 171816
instead of the __repr__. __repr__ is a function that should return an
expression that can be used to recreate an python object and we were using
it to just return a human readable string.
Fixed a crasher when using the new implementation of SBValue::Cast(SBType).
Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
improvements to the API.
Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
correctly handle not having a target.
llvm-svn: 149743
This is the actual fix for the above radar where global variables that weren't
initialized were not being shown correctly when leaving the DWARF in the .o
files. Global variables that aren't intialized have symbols in the .o files
that specify they are undefined and external to the .o file, yet document the
size of the variable. This allows the compiler to emit a single copy, but makes
it harder for our DWARF in .o files with the executable having a debug map
because the symbol for the global in the .o file doesn't exist in a section
that we can assign a fixed up linked address to, and also the DWARF contains
an invalid address in the "DW_OP_addr" location (always zero). This means that
the DWARF is incorrect and actually maps all such global varaibles to the
first file address in the .o file which is usually the first function. So we
can fix this in either of two ways: make a new fake section in the .o file
so that we have a file address in the .o file that we can relink, or fix the
the variable as it is created in the .o file DWARF parser and actually give it
the file address from the executable. Each variable contains a
SymbolContextScope, or a single pointer that helps us to recreate where the
variables came from (which module, file, function, etc). This context helps
us to resolve any file addresses that might be in the location description of
the variable by pointing us to which file the file address comes from, so we
can just replace the SymbolContextScope and also fix up the location, which we
would have had to do for the other case as well, and update the file address.
Now globals display correctly.
The above changes made it possible to determine if a variable is a global
or static variable when parsing DWARF. The DWARF emits a DW_TAG_variable tag
for each variable (local, global, or static), yet DWARF provides no way for
us to classify these variables into these categories. We can now detect when
a variable has a simple address expressions as its location and this will help
us classify these correctly.
While making the above changes I also noticed that we had two symbol types:
eSymbolTypeExtern and eSymbolTypeUndefined which mean essentially the same
thing: the symbol is not defined in the current object file. Symbol objects
also have a bit that specifies if a symbol is externally visible, so I got
rid of the eSymbolTypeExtern symbol type and moved all code locations that
used it to use the eSymbolTypeUndefined type.
llvm-svn: 144489
a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee
encapsulated by SBValue (WatchPointee).
Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that.
Modified the watchpoint related test suite to reflect the change.
Plus replacing WatchpointLocation with Watchpoint throughout the code base.
There are still cleanups to be dome. This patch passes the whole test suite.
Check it in so that we aggressively catch regressions.
llvm-svn: 141925
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
the SBType implementation classes.
Fixed LLDB core and the test suite to not use deprecated SBValue APIs.
Added a few new APIs to SBValue:
int64_t
SBValue::GetValueAsSigned(int64_t fail_value=0);
uint64_t
SBValue::GetValueAsUnsigned(uint64_t fail_value=0)
llvm-svn: 136829
clang/gcc/llvm-gcc. If the first breakpoint is due to stop at an inlined
frame, test that the call site corresponds to where it should be. Also add
an expecr for a second break stop, if the first break stop corresponds to an
inlined call frame #0.
rdar://problem/9741470
llvm-svn: 135100
For the print_stacktrace(thread, string_buffer = False) function, if we have debug info
for a frame function, let's also emit the args for the current function.
o TestFrameUtils.py:
Add stronger assertTrue for frame0's args.
o TestPrintStackTraces.py:
Launch the inferior with ["abc", "xyz"] and expect '(int)argc=3' in the stack traces, since
by design the inferior is built with debug info.
llvm-svn: 133204
o get_parent_frame(frame)
o get_args_as_string(frame)
to lldbutil.py and create TestFrameUtils.py to exercise the utils.
Plus re-arrange the test/python_api/lldbutil to have three directories
for testing iteration, process stack traces, and the just added frame utils.
llvm-svn: 131213
Also add three convenience functions get_GPRs(frame), get_FPRs(frame), and get_ESRs(frame) to get the general
purpose registers, the floating point registers, and the exception state registers.
Add TestRegistersIterator.py to test these added functions of lldbutil.py.
llvm-svn: 131144
method names of all the lldb container objects and returns an iterator object when
passed an eligible lldb container object.
Example:
from lldb_util import smart_iter
for thread in smart_iter(process):
ID = thread.GetThreadID()
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
stopped_due_to_breakpoint = True
for frame in smart_iter(thread):
self.assertTrue(frame.GetThread().GetThreadID() == ID)
...
Add a test case for lldb.smart_iter().
llvm-svn: 130332
i.e., with 'SBStream &description' first, followed by 'DescriptionLevel level'.
Modify lldbutil.py so that get_description() for a target or breakpoint location
can just take the lldb object itself without specifying an option to mean option
lldb.eDescriptionLevelBrief. Modify TestTargetAPI.py to exercise this logic path.
llvm-svn: 130147
expressions that are simple enough to get passed to the "frame var" underpinnings. The parser code will
have to be changed to also query for the dynamic types & offsets as it is looking up variables.
The behavior of "frame var" is controlled in two ways. You can pass "-d {true/false} to the frame var
command to get the dynamic or static value of the variables you are printing.
There's also a general setting:
target.prefer-dynamic-value (boolean) = 'true'
which is consulted if you call "frame var" without supplying a value for the -d option.
llvm-svn: 129623