Commit Graph

6405 Commits

Author SHA1 Message Date
Daniel Malea b7eec015d0 Rename [Enable|Disable]Breakpoint() to [Enable|Disable]BreakpointSite() in POSIX plugin
- needed due to r175241

llvm-svn: 175290
2013-02-15 20:23:25 +00:00
Daniel Malea 654b12c6a5 Linux test case cleanup:
- Enable TestFormatters.py: expressions with "new" work
- Enable TestChangeValueAPI.py: llvm.org/PR15039 fixed
- Disable expression_command/call-restarts due to llvm.org/PR15278
- Disable expression_command/call-throws due to ObjC test program

llvm-svn: 175287
2013-02-15 19:37:48 +00:00
Greg Clayton 79978fc0fc Added missing include.
llvm-svn: 175279
2013-02-15 17:44:31 +00:00
Filipe Cabecinhas 2f4ed2a8df Only enable RTTI for cxa_demangle.cpp
If testing on Linux+clang proves it needs RTTI, wa can remove the
conditionals.

llvm-svn: 175242
2013-02-15 02:36:40 +00:00
Jim Ingham 299c0c1c09 A little cleanup. {Disable/Enable}Breakpoint actually disables/enables BreakpointSites not breakpoints, it is confusing
to have it not named appropriately.  Also in StopInfoMachException, we aren't testing for software or not software, just
whether the thing is a breakpoint we set.  So don't use "software"...

llvm-svn: 175241
2013-02-15 02:06:30 +00:00
Enrico Granata 8628bc59e0 Daniel Malea caught an issue where calling dotest.py with an invalid directory would cause the progressbar init code to raise an exception
This commit fixes it

llvm-svn: 175229
2013-02-15 00:32:05 +00:00
Enrico Granata 75dfb43270 <rdar://problem/13204647>
The SEL data formatter was working hard to ensure that pointers-to-selectors could be formatted by the same block of code. In that effort, we were taking the address-of a SEL.
This operation fails when the SEL lives in a register, and was causing problems.
The formatter has been fixed to work correctly without assuming &selector will be a valid object.

llvm-svn: 175227
2013-02-15 00:06:04 +00:00
Daniel Malea 8d7b7a434a Fix TestSBData.py test case (tested fix Linux/Mac)
- stop ignoring the error-codes in the 'error' variable
- removed out-of-bounds accesses with read-only array fields such as:

  self.assertTrue(data2.uint8[6] == 0, 'binary 0 terminator')

Since SBData wraps a (6-character) python string literal, trying to read the
null-terminator raises an exception. Instead, I replaced the out-of-bounds
read with a length-check.

Other out-of-bounds reads (via accessor function like SBData.GetUnsignedInt8)
don't throw and are OK. I just added asserts that errors are set for these
negative cases.

llvm-svn: 175223
2013-02-14 23:38:33 +00:00
Filipe Cabecinhas 55fcb10542 Bring lldb up to date with clang revision 175141.
llvm-svn: 175213
2013-02-14 22:02:57 +00:00
Greg Clayton 790ecc01d7 <rdar://problem/13218655>
"target modules add" should resolve bundle executables, as should anything else that tries to create a module from a bundle path.

llvm-svn: 175210
2013-02-14 21:09:56 +00:00
Jim Ingham 6394479e4f One to many always's.
llvm-svn: 175202
2013-02-14 19:30:35 +00:00
Jim Ingham 719d2c9d36 Mention the inline-breakpoint-strategy in the lldb-gdb.html file.
llvm-svn: 175201
2013-02-14 19:17:49 +00:00
Greg Clayton 0ee809b71c <rdar://problem/13064893>
Poor network connections aren't handled well; commands fail instead of retrying.

llvm-svn: 175198
2013-02-14 19:11:23 +00:00
Jim Ingham 289aca642e Make it clear that if you #include .c/.cpp/.m/.mm etc files, you will have to
change the breakpoint-inline-strategy for the breakpoints to take.

<rdar://problem/13189024>

llvm-svn: 175197
2013-02-14 19:10:36 +00:00
Greg Clayton eee5e98658 <rdar://problem/12693921>
Rename the monitor command from "qCmd" (incorrect) to "qRcmd".

llvm-svn: 175191
2013-02-14 18:39:30 +00:00
Greg Clayton 25d5941e2a <rdar://problem/13207948>
"watchpoint set expression" fails if "--" is present without any option. Made this command match exactly what "expression" does.

llvm-svn: 175136
2013-02-14 04:15:23 +00:00
Greg Clayton 8938f8daf0 <rdar://problem/13200878>
When launching in the shell, make sure if you specify a relative path, and if the current working directory has a space in it, that we don't hose the shell invocation.

Currently if we launch with a relative path, we prepend the current working directory to the PATH using:

PATH=`cwd`:$PATH a.out ...

We needed to add quotes around the value for PATH to make sure if any paths in PATH contained spaces, that we don't hose the shell command. Now we do a:

PATH="`cwd`:$PATH" a.out ...

llvm-svn: 175135
2013-02-14 03:54:39 +00:00
Greg Clayton c5d33d8359 <rdar://problem/13198767>
When dumping instructions, resolve the address specified as a file address if the target doesn't have anything loaded.

llvm-svn: 175131
2013-02-14 03:26:35 +00:00
Jim Ingham 0ac5709027 Add a test for handling a function call that throws an exception, and make it work.
<rdar://problem/13183944>

llvm-svn: 175127
2013-02-14 03:05:42 +00:00
Jim Ingham 367efe7d34 Probably should return that value we took the trouble to compute.
llvm-svn: 175125
2013-02-14 03:04:50 +00:00
Daniel Malea 90e9fd9cbb Fix broken testcase: ignore LLDB output that warns about more elements than can be displayed.
- test could be re-written at some point, but right now just trying to clean up known failures for the linux buildbot.

llvm-svn: 175114
2013-02-14 00:30:40 +00:00
Daniel Malea e651aee927 Marking two tests expected-to-fail on Linux
- PR-15260: lldb does not display correct value of 1-bit field
- PR-16261: lldb does not display size of (file/class) static array

llvm-svn: 175111
2013-02-14 00:20:44 +00:00
Greg Clayton 399107a936 Centralized the expression prefixes that are used for both expressions and utility functions.
llvm-svn: 175108
2013-02-13 23:57:48 +00:00
Greg Clayton e40346050a A lot more cleanup on the AppleObjCRuntimeV2 class.
llvm-svn: 175106
2013-02-13 23:22:26 +00:00
Greg Clayton c03e3c198a Cleaned up and removed unused code.
llvm-svn: 175105
2013-02-13 23:09:45 +00:00
Matt Kopec 3c0ed76a9d Skip another two other tests asserting on Linux in RecordLayoutBuilder::updateExternalFieldOffset().
llvm-svn: 175103
2013-02-13 22:59:58 +00:00
Greg Clayton a66c4d96f0 <rdar://problem/13210494>
Parse objective C information as efficiently as possible and without taking dangerous runtime locks.

Reworked the way objective C information is parsed by:
1 - don't read all class names up front, this is about 500K of data with names
2 - add a 32 bit hash map that maps a hash of a name to the Class pointer (isa)
3 - Improved name lookups by using the new hash map
4 - split up reading the objc runtime info into dynamic and shared cache since the shared cache only needs to be read once.
5 - When reading all isa values, also get the 32 bit hash instead of the name
6 - Read names lazily now that we don't need all names up front
7 - Allow the hash maps to not be there and still have this function correctly

There is dead code in here with all of the various methods I tried. I want to check this in first to not lose any of it in case we need to revert to any of the extra code. I will promptly cleanup and commit again.

llvm-svn: 175101
2013-02-13 22:56:14 +00:00
Daniel Malea 5a52f2ec73 Skip test that causes lldb to assert due to inferior getting a SIGSEGV with si_code == SI_KERNEL (PR-15258)
- crash does not always reproduce

llvm-svn: 175095
2013-02-13 22:05:18 +00:00
Daniel Malea 5703bdcc49 Allow expression evaluation to work when multiple threads exist in the inferior (on Linux)
- handle m_resume_state == eStateStopped || eStateSuspended in DoResume rather than asserting

llvm-svn: 175094
2013-02-13 22:00:44 +00:00
Sean Callanan d7739824a6 Made NULL, nil, and Nil use the appropriate
builtins.

<rdar://problem/13204027>

llvm-svn: 175091
2013-02-13 21:53:01 +00:00
Andrew Kaylor b32581fe5c Improved handling for DW_AT_const_value
llvm-svn: 175071
2013-02-13 19:57:06 +00:00
Daniel Malea f406891857 Skip tests that assert on Linux in RecordLayoutBuilder::updateExternalFieldOffset()
- Filed bugzilla PR-15256

llvm-svn: 175065
2013-02-13 18:56:41 +00:00
Daniel Malea 52d0f40ad3 Disable TestConditionalBreak.py due to Linux crash
- test was passing before r174793...

llvm-svn: 175064
2013-02-13 18:55:17 +00:00
Greg Clayton 142c5a4f66 Quiet "the missing case in switch statement" warnings from newer clang builds.
llvm-svn: 175061
2013-02-13 18:15:56 +00:00
Daniel Malea 4d3c008c7d Fix document typos, indentation in python code, and API examples.
Patch by Bruce Mitchener!

llvm-svn: 175002
2013-02-12 20:01:49 +00:00
Greg Clayton faf6df6e6e Added new "env" regular expression alias into the evironment settings section of the GDB/LLDB commands.
llvm-svn: 174993
2013-02-12 18:54:34 +00:00
Greg Clayton ef5651d93f <rdar://problem/13178743>
Added a new "env" regular expression alias. If "env" is typed on its own "settings show target.env-vars" will be run. Otherwise it can be used to set and environment variable: "env FOO=BAR".

llvm-svn: 174991
2013-02-12 18:52:24 +00:00
Greg Clayton d901096345 <rdar://problem/13184389>
_regexp-list needs to treat "list -" as "source list -r"

llvm-svn: 174987
2013-02-12 18:42:05 +00:00
Matt Kopec 92dd5cfe04 Fix ELF parsing where undefined symbols were being added to the symbol table with the incorrect symbol type.
llvm-svn: 174984
2013-02-12 18:30:30 +00:00
Sean Callanan eeffea416b Made LLDB build with the latest Clang. This meant
changing the ClangASTSource to return a bool instead
of returning a list of results.  Our testsuite mostly
works with this change, but some minor issues may
remain both on LLDB's side and on Clang's side.

llvm-svn: 174949
2013-02-12 08:01:13 +00:00
Sean Callanan af77617b21 Fixed the way the ClangExpressionDeclMap looks
up variables in the current stack frame to avoid
mutual recursion between the expression parser
and the synthetic child providers.  Variables
should only be looked up in a very simple way,
using no synthetic anything.

<rdar://problem/13173454>

llvm-svn: 174947
2013-02-12 07:56:36 +00:00
Daniel Malea 69357ecb6d Minor update to Vim frontend: simplify breakpoints display (and list unresolved breakpoints)
llvm-svn: 174923
2013-02-12 00:31:40 +00:00
Jim Ingham 6ad180cf35 Forgot to add the testsuite for the changes I checked in on Friday.
llvm-svn: 174897
2013-02-11 19:05:29 +00:00
Daniel Malea ac4ce0cd4a Add Vim frontend to LLDB.
- Access any LLDB CLI command in Vim by typing ":L<command>". Tab-completion
  works too!
- See source locations for breakpoints and the current PC with vim "marks"
  and highlights.
- Examine backtraces, locals, disassembly, registers, and breakpoints in
  dedicated Vim windows.
- See when in-scope variables and registers change by watching for (red)
  highlights.

This plugin opens multiple Vim "windows" to display debugger information.
To quit all windows at the same time use ":qa". The alternative would be
":q" to close each window separately.

This plugin is known to work on Mac OS X (Mountain Lion) with MacVim and
the system-provided terminal Vim, and on Linux (Ubuntu 12.04 and 12.10)
with GVim and the terminal Vim from the "vim-gnome" package.

llvm-svn: 174892
2013-02-11 17:18:14 +00:00
Enrico Granata e1fb1654c8 Quick fix for the libc++ std::map synthetic children provider
If you try to access any child > 0 without having touched child 0, LLDB won't be able to reconstruct type information from the debug info.
Previously, we would fail.
Now, we simply go fetch child 0 and then come back.

llvm-svn: 174795
2013-02-09 01:44:23 +00:00
Jim Ingham 0161b49cba Reworked the way Process::RunThreadPlan and the ThreadPlanCallFunction interoperate to fix problems where
hitting auto-continue signals while running a thread plan would cause us to lose control of the debug 
session.

<rdar://problem/12993641>

llvm-svn: 174793
2013-02-09 01:29:05 +00:00
Enrico Granata eba9e4a3aa The new progress bar mode was losing us information compared to the old dots mode in that we would have no way of knowing about test failures (short of peeking into the test result directory.. and you're not supposed to peek!)
Added a new line of information that reports the count of tests that pass, fail or have other things happen to them.

Again no flag to have the dots back. If you care, let us know!

llvm-svn: 174784
2013-02-09 00:37:07 +00:00
Enrico Granata 27692bcf28 Fixing a logic flaw with NSURL summary. This was caught by running the test suite in 32bit mode
llvm-svn: 174778
2013-02-08 23:54:46 +00:00
Enrico Granata a94ee7da81 <rdar://problem/13176279>
The LLDB test suite now shows a progress bar instead of dots when not in verbose mode
If you crave the dots, make your Terminal window smaller than 10 columns :-)
(or ask for a flag to have the dots come back on demand)

llvm-svn: 174777
2013-02-08 23:39:18 +00:00
Sean Callanan 29214ab1ce Fixed a crash when we didn't get a plist but tried
to pass it to CFGetTypeID() anyway.

<rdar://problem/13181904>

llvm-svn: 174772
2013-02-08 23:17:17 +00:00
Greg Clayton 2452ab7fa8 Fixed 2 more issues found by the address sanitizer:
1 - A store off the end of a buffer in ValueObject.cpp
2 - DataExtractor had cases where bad offsets could cause invalid memory to be accessed.

llvm-svn: 174757
2013-02-08 22:02:02 +00:00
Greg Clayton aa4c47a5b1 Fixed a store to data that isn't needed and that also could end up writing beyond the end of the buffer. This was found by the address sanitizer.
llvm-svn: 174755
2013-02-08 21:59:34 +00:00
Greg Clayton 0dd5e7b598 Unset the environment variables as soon as possible when running the test suite. Also don't store the unset list into a global when they aren't needed in a global variable.
llvm-svn: 174750
2013-02-08 21:52:32 +00:00
Enrico Granata e214a024e0 This checkin implements the data formatter for NSURL in C++ code
llvm-svn: 174735
2013-02-08 19:28:04 +00:00
Greg Clayton 722e8851b1 Added the ability to specify a breakpoint using the GDB '*ADDRESS' format:
(lldb) b *0x1234

You can still of course just specify an address:

(lldb) b 0x1234

Also now we accept the '&' before function names to indicate to not to skip the function prologue like GDB supports. To see how this works:

(lldb) settings set interpreter.expand-regex-aliases 1
(lldb) b &main
breakpoint set --name 'main' --skip-prologue=0
Breakpoint 1: where = a.out`main at main.c:20, address = 0x0000000100000b60
(lldb) b main
breakpoint set --name 'main'
Breakpoint 2: where = a.out`main + 54 at main.c:21, address = 0x0000000100000b96

llvm-svn: 174695
2013-02-08 02:54:24 +00:00
Enrico Granata 5bfce363e1 <rdar://problem/12898191>
Added a summary for NSMutableAttributedString
In the process, converted formatters for other NSString-based classes over to C++ code

llvm-svn: 174693
2013-02-08 01:55:46 +00:00
Enrico Granata 08ec0b6117 Renaming SBValueList::get() to
opaque_ptr since it returns a void* instead of an usable object.

llvm-svn: 174673
2013-02-07 22:57:46 +00:00
Enrico Granata d96f0682e5 Correct logging for function calls that return SBValueList
llvm-svn: 174670
2013-02-07 22:22:27 +00:00
Greg Clayton 64ff6c70da Be sure to set the data offset to zero if we actually mmap the entire ELF file.
llvm-svn: 174668
2013-02-07 21:49:54 +00:00
Andrew Kaylor 213f6727c0 Fixing stale pointer problem in ELFObjectFile
llvm-svn: 174665
2013-02-07 21:30:54 +00:00
Enrico Granata 85425d77b8 <rdar://problem/13107151>
SBValueList was backed by a ValueObjectList. This caused us to lose track of the additional metadata in the ValueImpl that backs SBValue.
This checkin fixes that by backing SBValueList with ValueListImpl (that essentially wraps a vector<SBValue>).

llvm-svn: 174638
2013-02-07 18:23:56 +00:00
Greg Clayton 5c9737a5dd Address sanitizer found an issue which we filed a bug for: <rdar://problem/13168967>
llvm-svn: 174579
2013-02-07 03:41:30 +00:00
Greg Clayton f6cdd126e8 Fixed an bug found by running LLDB with the address sanitizer! We were accessing one past the end of the buffer.
llvm-svn: 174578
2013-02-07 03:38:34 +00:00
Greg Clayton cb9c8cf84c Be ready for fully qualified hash names in the __apples_types tables.
llvm-svn: 174558
2013-02-06 23:56:13 +00:00
Sean Callanan c3a1d5629a Fixed a problem that would cause LLDB to crash
if it encountered bad debug information.  This
debug information had an Objective-C method whose
selector disagreed with the true number of arguments
to that method.

<rdar://problem/12992864>

llvm-svn: 174557
2013-02-06 23:21:59 +00:00
Greg Clayton 1f380ea29a Removed debug print line I left in.
llvm-svn: 174556
2013-02-06 22:52:04 +00:00
Greg Clayton 5ce9c5657c <rdar://problem/13159777>
lldb was mmap'ing archive files once per .o file it loads, now it correctly shares the archive between modules.

LLDB was also always mapping entire contents of universal mach-o files, now it maps just the slice that is required.

Added a new logging channel for "lldb" called "mmap" to help track future regressions.

Modified the ObjectFile and ObjectContainer plugin interfaces to take a data offset along with the file offset and size so we can implement the correct caching and efficient reading of parts of files without mmap'ing the entire file like we used to.

The current implementation still keeps entire .a files mmaped (once) and entire slices from universal files mmaped to ensure that if a client builds their binaries during a debug session we don't lose our data and get corrupt object file info and debug info.

llvm-svn: 174524
2013-02-06 17:22:03 +00:00
Daniel Malea 0e1cf09c89 Fix bug in test harness to allow running dotest.py without "--executable" flag on Linux
- resolves errors in cases that run the lldb CLI utility

llvm-svn: 174522
2013-02-06 16:55:07 +00:00
Daniel Malea eed92fb10c Fix to build tests with GCC: update makefiles in two watchpoint testcases
llvm-svn: 174520
2013-02-06 16:51:24 +00:00
Daniel Malea 0b464d483b Fix GCC 4.6 build by avoiding delegating ctors
Patch by Abid Hafiz!

llvm-svn: 174519
2013-02-06 16:46:40 +00:00
Greg Clayton 906ba47143 <rdar://problem/11109570>
The first part of the fix for having LLDB handle LTO debugging when the DWARF is in the .o files. This part separates the object file's modules into a separate cache map that maps unique C strings for the N_OSO path to the ModuleSP since one object file might be mentioned more than once in LTO binaries.

llvm-svn: 174476
2013-02-06 00:38:25 +00:00
Greg Clayton 12ff126f04 Fixed the TestSourceManager.py test case to not fail. It was using the "list" alias which has now been turned into a regex command that mimics the GDB equivalent. Changed "list" to "source list" to get around this problem.
llvm-svn: 174474
2013-02-06 00:35:33 +00:00
Jason Molenda d34e652ef8 Change ObjectFileMachO::ParseSymtab to read the external
function stub routine addresses from an in-memory-only
MachO object file.  This was the only remaining part of
ParseSymtab() that was assuming a file exists.
<rdar://problem/13139585> 

llvm-svn: 174455
2013-02-05 22:31:24 +00:00
Enrico Granata cb9870dad8 Being explicit about which std c++ library these test cases need to use
llvm-svn: 174437
2013-02-05 20:05:31 +00:00
Greg Clayton 61f39ce8b8 <rdar://problem/12866706>
Removed asserts and replaced them with conditional code and appropriate errors that prompt for a bug to be filed.

llvm-svn: 174420
2013-02-05 18:40:36 +00:00
Jason Molenda 18257c4106 Remove the m_images(NULL) hack in the Target ctor now
that the original issue has been fixed by r174222.

llvm-svn: 174334
2013-02-04 23:30:05 +00:00
Enrico Granata 3b1b2dabda <rdar://problem/12953018>
Synthetic children and summary for std::vector<bool> (for both libcxx and libstdcpp).
std::vector<bool> is a special case and is custom-implemented to be a vector of bits, which means we failed to handle it with the standard std::vector<T> formatter.
This checkin provides custom formatters that work correctly

llvm-svn: 174333
2013-02-04 22:54:42 +00:00
Jason Molenda b9c9f9b200 Change CommandObjectTargetSymbolsAdd to require that a target exists;
fixes crash of the form

% lldb
(lldb) target symbols add /tmp/symbols.dSYM
(lldb) Killed: 9

<rdar://problem/13139481> 

llvm-svn: 174267
2013-02-02 06:00:36 +00:00
Greg Clayton 4edb7ab8b2 Added support for the qCmd monitor packet command. Currently it can only do:
set logfile=<path>
set logmask=<num>

But this opens the door for us to do much more.

llvm-svn: 174258
2013-02-02 01:13:48 +00:00
Enrico Granata 599171addf Moving from std::auto_ptr<char> to std::string for simple string memory management.
It is better practice and, also, it is not clear whether std::auto_ptr<> is smart enough to know about delete[] vs. delete

llvm-svn: 174236
2013-02-01 23:59:44 +00:00
Greg Clayton 6bade327dc <rdar://problem/13050227>
Added a regular expression command called "_regexp-list" which mimics the GDB "line" command in the following forms:

LINENUM, to list around that line in current file,
FILE:LINENUM, to list around that line in that file,
FUNCTION, to list around beginning of that function,
*ADDRESS, to list around the line containing that address.
ADDRESS, same as above, but don't require a '*' as long as ADDRESS is hex

llvm-svn: 174233
2013-02-01 23:33:03 +00:00
Greg Clayton ba4a0a5db5 <rdar://problem/12693921>
Added the ability to send monitor command to the remote GDB server with "process plugin packet monitor".

llvm-svn: 174231
2013-02-01 23:03:47 +00:00
Greg Clayton f5fc08445f <rdar://problem/13130975>
Class global variables were not being linked correctly when debugging with DWARF in .o files.

llvm-svn: 174227
2013-02-01 22:08:49 +00:00
Greg Clayton 39f7ee86c8 <rdar://problem/13092722>
Fix in loading mach files from memory when using DynamicLoaderMacOSXDYLD.

Removed the uuid mismatch warning that could be spit out and any time during debugging and removed the test case that was looking for that. Currently the "add-dsym" or "target symbols add" command will report an error when the UUID's don't match.

Be more careful when checking and resolving section + offset addresses to make sure none of the base addresses are invalid.

llvm-svn: 174222
2013-02-01 21:38:35 +00:00
Jim Ingham 95a777e915 Correct the definition of ObjC's BOOL in our pre-canned set of defines. It's supposed to
be "signed char" not "int".

<rdar://problem/13131126>

llvm-svn: 174209
2013-02-01 19:33:52 +00:00
Sean Callanan fa4fab77d4 Modified the expression parser's class wrapper to
support reporting "this" as a templated class.  The
expression parser wraps expressions in C++ methods
as methods with the signature

$__lldb_class::$__lldb_expr(...)

and previously responded to clang's queries about
$__lldb_class with the type of *this.  This didn't
work if *this was a ClassTemplateSpecializationDecl
because ClassTemplateSpecializationDecls can't be
the result of simple name queries.

Instead what we do now is respond that $__lldb_class
is a typedef and that the target of the typedef is
the (potentially templated) type of *this.  That is
much more robust.

Thanks to John McCall for key insights.

<rdar://problem/10987183>

llvm-svn: 174153
2013-02-01 06:55:48 +00:00
Greg Clayton abb487f57a Make sure a value is returned for Thread::ReturnFromFrame().
llvm-svn: 174141
2013-02-01 02:52:31 +00:00
Greg Clayton 13fbb99107 Allow the target to give out the size of the red zone for given ABIs.
A bit of cleanup in the heap module. 

llvm-svn: 174129
2013-02-01 00:47:49 +00:00
Greg Clayton 3dcaa2c8c8 Get rid for switch statement warning for unhandled cases.
llvm-svn: 174128
2013-02-01 00:46:49 +00:00
Greg Clayton 4959b7b8f5 Fixed register dumping for contained-regs.
llvm-svn: 174127
2013-02-01 00:45:52 +00:00
Jim Ingham 93208b8680 Add "thread return -x" to unwind the innermost user called expression (if you happen to have stopped in it due to a crash.)
Make the message when you hit an crash while evaluating an expression a little clearer, and mention "thread return -x".

rdar://problem/13110464

llvm-svn: 174095
2013-01-31 21:46:01 +00:00
Jim Ingham afc1b12f01 Change the default behavior for unwinding and breakpoints when running expressions.
<rdar://problem/13121442>

llvm-svn: 174082
2013-01-31 19:48:57 +00:00
Enrico Granata 8471f0477b Making sure a Pythonless build of LLDB works by #ifdef-ing out formatters code.
llvm-svn: 174074
2013-01-31 18:24:22 +00:00
Greg Clayton e7fc9ccf2e Added the ability to search segments for data. Currently __TEXT, __LINKEDIT and __PAGEZERO are excluded.
Added many more cleanups to the output.

llvm-svn: 174045
2013-01-31 06:38:09 +00:00
Greg Clayton 85e62eca66 expressions + C++11 lambdas == cooooool!!!
C++11 lambdas that don't capture anything can be used as static callback functions!

Heavily modified this python module to be able to not require a dylib in order to traverse the heap allocations.

Re-implemented the ptr_refs, objc_refs, malloc_info and cstr_refs to use complex expressions that use lambdas to do all static callback function work.

llvm-svn: 173989
2013-01-30 22:57:34 +00:00
Jason Molenda a46db7728e Verified that the plugin.dynamic-loader.darwin-kernel.scan-type
setting is working correctly now; remove the #if 0's around its
use.

llvm-svn: 173982
2013-01-30 22:19:51 +00:00
Enrico Granata 54f279fff6 <rdar://problem/12552374> & <rdar://problem/13100674>
The vtable pointer field is not necessarily a pointer and hence cannot be used for validation

llvm-svn: 173947
2013-01-30 17:44:16 +00:00
Dmitri Gribenko aa073de21a llvm/Basic/ConvertUTF.h now exposes all functions without macro tricks
llvm-svn: 173937
2013-01-30 15:12:30 +00:00
Dmitri Gribenko 024aa8539f UTF conversion routines were moved from clang/Basic to llvm/Support
llvm-svn: 173935
2013-01-30 15:05:59 +00:00
Jason Molenda 6396922186 Fix one obvious thinko with the plugin.dynamic-loader.darwin-kernel.scan-type setting
handling that was probably the source of the settings problem.  Need to verify that
it's working correctly tomorrow though.

llvm-svn: 173894
2013-01-30 04:48:16 +00:00
Jason Molenda 6ba6d3d179 <rdar://problem/12491235>
Enhance lldb so it can search for a kernel in memory when attaching
to a remote system.  Remove some of the code that was doing this
from ProcessMachCore and ProcessGDBRemote and put it in
DynamicLoaderDarwinKernel.

I've added a new setting, plugin.dynamic-loader.darwin-kernel.scan-type
which can be set to

 none   - for environments where reading random memory can cause a
          device crash 
 basic  - look at one fixed location in memory for a kernel load address, 
          plus the contents of that address
 fast-scan - the default, tries "basic" and then looks for the kernel's
          mach header near the current pc value when lldb connects
 exhaustive-scan - on 32-bit targets, step through the entire range where
          the kernel can be loaded, looking for the kernel binary

I don't have the setting set up correctly right now, I'm getting back unexpected
values from the Property system, but I'll figure that out tomorrow and fix.
Besides that, all of the different communication methods / types of kernels 
appear to be working correctly with these changes.

llvm-svn: 173891
2013-01-30 04:39:32 +00:00
Daniel Malea 30b95a3668 Fix build problems with libstdc++ 4.6/4.7
- remove nullptr from initialization of shared_ptrs

llvm-svn: 173870
2013-01-30 01:01:11 +00:00
Filipe Cabecinhas 45f0c66bc3 Use printf instead of echo -n (the latter won't work on OS X's /bin/sh)
llvm-svn: 173867
2013-01-30 00:48:11 +00:00
Greg Clayton 325e869463 Remove debug code and commented out code that was left in.
llvm-svn: 173865
2013-01-30 00:29:53 +00:00
Filipe Cabecinhas 8bc6534701 Continuing the fix for the r173732 fix. Now lldb gets built with Makefiles (Darwin).
llvm-svn: 173864
2013-01-30 00:28:58 +00:00
Greg Clayton 1b3815cbf4 <rdar://problem/9141269>
Cleaned up the objective C name parsing code to use a class.

Now breakpoints that are set by name that are objective C methods without the leading '+' or '-' will resolve. We do this by expanding all the objective C names for a given string. For example:

(lldb) b [MyString cStringUsingEncoding:]

Will set a breakpoint with multiple possible names: 
-[MyString cStringUsingEncoding:]
+[MyString cStringUsingEncoding:]

Also if you have a category, it will strip the category and set a breakpoint in all variants:

(lldb) [MyString(my_category) cStringUsingEncoding:]

Will resolve to the following names:

-[MyString(my_category) cStringUsingEncoding:]
+[MyString(my_category) cStringUsingEncoding:]
-[MyString cStringUsingEncoding:]
+[MyString cStringUsingEncoding:]

Likewise when we have:

(lldb) b -[MyString(my_category) cStringUsingEncoding:]

It will resolve to two names:
-[MyString(my_category) cStringUsingEncoding:]
-[MyString cStringUsingEncoding:]

llvm-svn: 173858
2013-01-30 00:18:29 +00:00
Filipe Cabecinhas 276a08b5b1 Actually build DataFormatters dir. Fix for the r173732 fix.
llvm-svn: 173840
2013-01-29 22:20:20 +00:00
Greg Clayton b25406cd9d <rdar://problem/13107904>
wchar_t causes problem with certain compilers. Removing it for now.

llvm-svn: 173823
2013-01-29 20:03:58 +00:00
Enrico Granata 59de94bd4e Since an address (0x12346) is an expression, be brief.
llvm-svn: 173757
2013-01-29 02:46:04 +00:00
Enrico Granata b84a9dbf6b <rdar://problem/12552374>
Replacing the address argument type with address-expression in cases where StringToAddress() is used, and hence an expression can be passed where previously only a numeric address was allowed
This makes the documentation more clear and helps users discover that they can truly pass in an expression in these situations.

llvm-svn: 173753
2013-01-29 01:48:30 +00:00
Enrico Granata 9a31ccbad8 <rdar://problem/12890171>
Providing a compact display mode for "po" to use where the convenience variable name and the pointer value are both hidden.
This is for convenience when dealing with ObjC instances where the description often gets it right and the debugger-provided information is not useful to most people.
If you need either of these, "expr" will still show them.

llvm-svn: 173748
2013-01-29 01:35:01 +00:00
Greg Clayton 3c94737fb7 <rdar://problem/12524607>
Flush the process when symbols are loaded/unloaded manually. This was going on in:
- "target modules load" command
- SBTarget::SetSectionLoadAddress(...)
- SBTarget::ClearSectionLoadAddress(...)
- SBTarget::SetModuleLoadAddress(...)
- SBTarget::ClearModuleLoadAddress(...)

llvm-svn: 173745
2013-01-29 01:17:09 +00:00
Enrico Granata d7760bffda Describe the data formatters as part of the architecture
llvm-svn: 173734
2013-01-29 00:42:12 +00:00
Enrico Granata 3c8d169843 Adding a Makefile. Hopefully that will make the Linux buildbot happy
llvm-svn: 173732
2013-01-29 00:29:33 +00:00
Greg Clayton c96029e118 Fixed a "wchar_t" typo.
llvm-svn: 173731
2013-01-29 00:29:18 +00:00
Enrico Granata 5548cb50b2 <rdar://problem/12978143>
Data formatters now cache themselves.
This commit provides a new formatter cache mechanism. Upon resolving a formatter (summary or synthetic), LLDB remembers the resolution for later faster retrieval.
Also moved the data formatters subsystem from the core to its own group and folder for easier management, and done some code reorganization.
The ObjC runtime v1 now returns a class name if asked for the dynamic type of an object. This is required for formatters caching to work with the v1 runtime.
Lastly, this commit disposes of the old hack where ValueObjects had to remember whether they were queried for formatters with their static or dynamic type.
Now the ValueObjectDynamicValue class works well enough that we can use its dynamic value setting for the same purpose.

llvm-svn: 173728
2013-01-28 23:47:25 +00:00
Greg Clayton 5b2a789c6f Always define types from stdint.h so they are always available for use in expressions no matter what debug info you have. Types added are:
int8_t
uint8_t
int16_t
uint16_t
int32_t
uint32_t
int64_t
uint64_t
intptr_t
uintptr_t
size_t
ptrdiff_t
whar_t

llvm-svn: 173724
2013-01-28 22:31:43 +00:00
Greg Clayton ba7b8e2c8c Make sure that multi-line expressions don't create a default target. We recently switched to using a built-in m_exe_ctx when running commands in the DoExecute() so that we can have common code where commands can required having a valid target/process/thread/frame by specifying flags, this caused multi-line expression to always create a new dummy target because m_exe_ctx gets cleared when DoExecute exits. A new input reader has been pushed to handle the input for the expression, which will get popped off and then it was checking the target in m_exe_ctx (which was cleared).
llvm-svn: 173596
2013-01-26 23:54:29 +00:00
Jason Molenda ec2546ab97 One more change of a uint32_t variable to offset_t
to match Greg's dataextractor patch, this one in some
#if defined arm code.

llvm-svn: 173564
2013-01-26 07:06:09 +00:00
Jason Molenda 4eacc7647d Add comments showing the symbolic names for the exc_code types we
receive with an EXC_BREAKPOINT mach exception on arm.

llvm-svn: 173560
2013-01-26 05:30:38 +00:00
Jim Ingham 2995077d8a Add "target.process.stop-on-shared-library-events" setting, and make it work.
Add the ability to give breakpoints a "kind" string, and have the StopInfoBreakpoint
print that in the brief description if set.  Also print the kind - if set - in the breakpoint
listing.
Give kinds to a bunch of the internal breakpoints.
We were deleting the Mac OS X dynamic loader breakpoint as though the id we had stored away was
a breakpoint site ID, but in fact it was a breakpoint id, so we never actually deleted it.  Fixed that.

llvm-svn: 173555
2013-01-26 02:19:28 +00:00
Jim Ingham 9d8dd4bf52 Missing newline in a warning message.
llvm-svn: 173519
2013-01-25 23:05:01 +00:00
Daniel Malea 318cbcef91 Disable confirmation prompts for testing
- set auto-confirm to false when running TestExprs (avoid hang when using API)
- set prompt-on-quit to false in test helper (avoid timeout when using lldb CLI)

llvm-svn: 173485
2013-01-25 20:38:49 +00:00
Daniel Malea eb19a95322 Remove hardcoded -arch from lang/cpp testcase makefiles
- skip rdar12991846 (already marked expected-fail) to avoid introducing a i386 crash

llvm-svn: 173483
2013-01-25 20:33:59 +00:00
Greg Clayton e2a2222d53 Fix buildbot building errors.
llvm-svn: 173473
2013-01-25 19:40:54 +00:00
Daniel Malea d6a5531d42 Fix indenting typo in TestSTL.py
llvm-svn: 173470
2013-01-25 19:14:49 +00:00
Han Ming Ong 00a5799698 <rdar://13073234>
Get the number of threads correct.

llvm-svn: 173466
2013-01-25 18:32:24 +00:00
Greg Clayton c7bece56fa <rdar://problem/13069948>
Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary.

So I defined a new "lldb::offset_t" which should be used for all file offsets.

After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed.

Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections.

llvm-svn: 173463
2013-01-25 18:06:21 +00:00
Jason Molenda a71919c9d6 <rdar://problem/13072285>
Change the GDBRemoteRegisterContext::AddRegister function to take
its RegisterInfo argument by value instead of using a reference -
it will modify the object and modifying the contents of the 
g_register_infos table in GDBRemoteRegisterContext.cpp can cause a
crash the next time we step through it.

llvm-svn: 173406
2013-01-25 01:05:30 +00:00
Daniel Malea 2745d8467b Update test scripts and Makefiles to allow testing with GCC:
- introduce new variable ARCHFLAG in make/Makefile.rules to switch between "-arch" on Mac and "-m" everywhere else
- update testcase makefiles to use LD_EXTRAS instead of LDFLAGS (the former interacts with Makefile.rules badly)
- special treatment for gcc 4.6: replace "-std=c++11" with "-std=c++0x" as the former is not handled correctly
- remove hardcoded "-arch" from test Makefile

This patch should not have any effect on lldb on Mac OS X.

llvm-svn: 173402
2013-01-25 00:31:48 +00:00
Daniel Malea be230793fb Mark test cases affected by PR 15036 (GCC-generated DWARF causes parser crash)
- Add new decorator "@skipIfGcc" to lldbtest.py

llvm-svn: 173394
2013-01-24 23:52:09 +00:00
Jim Ingham d30df9e24c Don't listen for EXC_RESOURCE exceptions, those should really be handled by the system
handler.  Also put in string translations for a couple of exceptions we were missing.

llvm-svn: 173390
2013-01-24 23:33:19 +00:00
Daniel Malea db14eb25a0 Skip 32-bit testing of check_public_api_headers (on all platforms, not just Mac OS X)
- since the test program needs to link with LLDB, the test is invalid in 32-bit mode.

llvm-svn: 173372
2013-01-24 21:01:12 +00:00
Daniel Malea b8f80ee67f Marking test cases with @expectedFailureLinux as per recently opened bugs
- PR 15038: missing wide char support on Linux
- PR 14600 - Exception state registers not supported on Linux
- PR 15039: SBProcess.GetSTDOUT() returns an empty buffer
- PR 15037: stop-hooks sometimes fail to fire on Linux

llvm-svn: 173363
2013-01-24 19:47:06 +00:00
Daniel Malea cf7304a201 PR14426 (breakpoint hit count incorrect) is resolved.
llvm-svn: 173362
2013-01-24 19:35:57 +00:00
Jim Ingham 8bebe00a24 Check for NULL breakpoint option thread name & queue name before comparing their values to the new value.
<rdar://problem/13065198>

llvm-svn: 173308
2013-01-23 23:14:13 +00:00
Jason Molenda 761263bf47 Remove a compile time warning in RNBRemote::HandlePacket_qProcessInfo
for non-x86 builds.

llvm-svn: 173226
2013-01-23 04:39:43 +00:00
Jason Molenda fa85ca5fff Change the container-regs kv pair in the qRegsiterInfo
reply to be hex encoded, not decimal.

Fix the whitespace in the container-regs/invalidate-regs
documentation, fix one ambiguous hex/decimal number in an
example.

llvm-svn: 173225
2013-01-23 04:38:32 +00:00
Enrico Granata f7b1a34e47 <rdar://problem/12711206>
Extending ValueObjectDynamicValue so that it stores a TypeAndOrName instead of a TypeSP.
This change allows us to reflect the notion that a ValueObject can have a dynamic type for which we have no debug information.
Previously, we would coalesce that to the static type of the object, potentially losing relevant information or even getting it wrong.
This fix ensures we can correctly report the class name for Cocoa objects whose types are hidden classes that we know nothing about (e.g. __NSArrayI for immutable arrays).
As a side effect, our --show-types argument to frame variable no longer needs to append custom dynamic type information.

llvm-svn: 173216
2013-01-23 01:17:27 +00:00
Enrico Granata c50b44801c lldb.thread is not to be used anymore
llvm-svn: 173119
2013-01-22 02:32:56 +00:00
Sean Callanan b1de8dd986 Quick fix to make LLDB TOT work with Clang TOT.
Avoids an error about an ambiguous constructor
call.

llvm-svn: 173118
2013-01-22 02:20:20 +00:00
Enrico Granata 13615ede54 Replacing a "no clue why" comment with the explanation it was demanding
llvm-svn: 173111
2013-01-22 01:43:59 +00:00
Greg Clayton 8e44d749f7 Clear up the documentation for the "container-regs" and "invalidate-regs" key/value pair responses for qRegisterInfo with examples of single and multiple registers for each.
llvm-svn: 173107
2013-01-21 23:54:42 +00:00
Greg Clayton 0ba20241a6 Changed the register number lists for the qRegisterInfo packet response to be raw hex to match all other register reading and writing APIs.
llvm-svn: 173105
2013-01-21 23:32:42 +00:00
Greg Clayton 3dd50a498d Added all of the 16 and 8 bit register variants for i386.
Modified the ARM register context to invalidate r8 - r14 when the CPSR register is modified.

llvm-svn: 173104
2013-01-21 23:25:18 +00:00
Greg Clayton 16ed2611f4 Updated the LLDB qRegisterInfo documentation to contain information on the new "invalidate-regs" and "container-regs" keys that can be returned in response to a qRegisterInfo packet.
llvm-svn: 173102
2013-01-21 23:18:28 +00:00
Greg Clayton ce1ffcf8a2 <rdar://problem/13020634>
Fixed the 32, 16, and 8 bit pseudo regs for x86_64 (real reg of "rax" which subvalues "eax", "ax", etc...) to correctly get updated when stepping. Also fixed it so actual registers can specify what other registers must be invalidated when a register is modified. Previously, only pseudo registers could invalidate other registers.

Modified the LLDB qRegisterInfo extension to the GDB remote interface to support specifying the containing registers with the new "container-regs" key whose value is a comma separated list of register numbers. Also added a "invalidate-regs" key whose value is also a comma separated list of register numbers. 

Removed the hack GDBRemoteDynamicRegisterInfo::Addx86_64ConvenienceRegisters() function and modified "debugserver" to specify the registers correctly using the new "container-regs" and "invalidate-regs" keys.

llvm-svn: 173096
2013-01-21 22:17:50 +00:00
Enrico Granata 6b4ddc655a <rdar://problem/12437929>
Providing a special mode of operator for "memory read -f c-str" which actually works in most common cases
Where the old behavior would provide:
(lldb) mem read --format s `foo`
0x100000f5d: NULL

Now we do:
(lldb) mem read --format s `foo`
0x100000f5d: "hello world"

You can also specify a count and that many strings will be showed starting at the initial address:
(lldb) mem read -c 2 -f c-str `foo`
0x100000f1d: "hello world"
0x100000f29: "short"

llvm-svn: 173076
2013-01-21 19:20:50 +00:00
Jason Molenda 4c781fd78a <rdar://problem/12350715>
Modify UnwindLLDB::SearchForSavedLocationForRegister so if the register
save locations for a register mid-stack is in another register (or in the
same register, indicating the reg wasn't modified in this frame), don't
return that as a found location.  Keep iterating down the array of frames
until a concrete location/value for the register is found, or until we
get to frame 0 where the reg value can be used as-is.

If lldb was trying to backtrace a program that blew out its stack via
recursion and the unwind instructions had some kind of 
this-reg-is-saved-in-that-reg instruction, lldb would revert to doing 
a recursive search for a concrete value and blow out its own stack.

llvm-svn: 172887
2013-01-19 03:53:42 +00:00
Sean Callanan a2868d4c2e Extended LLDB to handle blocks capturing 'self'
in an Objective-C class method.  Before, errors
of the form

error: cannot find interface declaration for '$__lldb_objc_class'

would appear when running any expression when
the current frame is a block that captures 'self'
from an Objective-C class method.

<rdar://problem/12905561>

llvm-svn: 172880
2013-01-19 01:49:02 +00:00