Commit Graph

743 Commits

Author SHA1 Message Date
Jim Ingham 6657d09e8b ValueObjectRegister type value objects should obey the format in ValueAsCString.
<rdar://problem/10719481>

llvm-svn: 148494
2012-01-19 21:10:56 +00:00
Greg Clayton 5b6889b1f6 Fixed an issue in the debugger format strings that include "${function.name-with-args}"
where we grabbed the variable list size from the wrong list (we needed it
from "args" and we were getting it from "variable_list_sp").

llvm-svn: 148425
2012-01-18 21:56:18 +00:00
Greg Clayton 32720b51e2 <rdar://problem/9731573>
Fixed two double "int close(int fd)" issues found by our file descriptor
interposing library on darwin:

The first is in SBDebugger::SetInputFileHandle (FILE *file, bool transfer_ownership)
where we would give our FILE * to a lldb_private::File object member variable and tell
it that it owned the file descriptor if "transfer_ownership" was true, and then we
would also give it to the communication plug-in that waits for stdin to come in and
tell it that it owned the FILE *. They would both try and close the file.

The seconds was when we use a file descriptor through ConnectionFileDescriptor 
where someone else is creating a connection with ConnectionFileDescriptor and a URL
like: "fd://123". We were always taking ownwership of the fd 123, when we shouldn't
be. There is a TODO in the comments that says we should allow URL options to be passed
to be able to specify this later (something like: "fd://123?transer_ownership=1"), but
we can get to this later.

llvm-svn: 148201
2012-01-14 20:47:38 +00:00
Greg Clayton ccbc08e6ae <rdar://problem/10684141>
When the lldb_private::Debugger goes away, it should cleanup all
of its targets.

llvm-svn: 148189
2012-01-14 17:04:19 +00:00
Greg Clayton 6d3dbf5161 Added a new thread and frame format that can be used to display a function
name + arguments when the data is available. It seems to work really well, 
but some more testing is needed before we make this on by default.

The new function format name is:

 ${function.name-with-args}

To see how to use these formats see the website:

    http://lldb.llvm.org/formats.html

Here is a sample backtrace of debugging LLDB with LLDB using this new format
value:

(lldb) thread backtrace all
* thread #1: tid = 0x2203, 0x00007fff88a17bca libsystem_kernel.dylib __psynch_cvwait + 10, stop reason = signal SIGINT, name = <lldb.driver.main-thread>, queue = com.apple.main-thread
    frame #0: 0x00007fff88a17bca libsystem_kernel.dylib __psynch_cvwait + 10
    frame #1: 0x00007fff884ae274 libsystem_c.dylib _pthread_cond_wait + 840
    frame #2: 0x00000001010778ea LLDB lldb_private::Condition::Wait(this=0x0000000104846770, mutex=0x0000000104846730, abstime=0x0000000000000000, timed_out=0x00007fff5fbfdea7) + 138 at Condition.cpp:92
    frame #3: 0x0000000101244c21 LLDB lldb_private::Predicate<bool>::WaitForValueEqualTo(this=0x0000000104846728, value=true, abstime=0x0000000000000000, timed_out=0x00007fff5fbfdea7) + 209 at Predicate.h:317
    frame #4: 0x0000000100f6eeb2 LLDB lldb_private::Listener::WaitForEventsInternal(this=0x0000000104846660, timeout=0x0000000000000000, broadcaster=0x0000000000000000, broadcaster_names=0x0000000000000000, num_broadcaster_names=0x00000000, event_type_mask=0x00000000, event_sp=0x00007fff5fbfe030) + 386 at Listener.cpp:388
    frame #5: 0x0000000100f6f231 LLDB lldb_private::Listener::WaitForEvent(this=0x0000000104846660, timeout=0x0000000000000000, event_sp=0x00007fff5fbfe030) + 81 at Listener.cpp:436
    frame #6: 0x0000000100098dcd LLDB lldb::SBListener::WaitForEvent(this=0x00007fff5fbff0f0, timeout_secs=0xffffffff, event=0x00007fff5fbfe430) + 685 at SBListener.cpp:181
    frame #7: 0x000000010000628c lldb Driver::MainLoop(this=0x00007fff5fbff620) + 5244 at Driver.cpp:1325
    frame #8: 0x0000000100006ca3 lldb main(argc=1, argv=0x00007fff5fbff758, envp=0x00007fff5fbff768) + 419 at Driver.cpp:1460
    frame #9: 0x0000000100000d54 lldb start + 52

  thread #3: tid = 0x2703, 0x00007fff88a17df2 libsystem_kernel.dylib select$DARWIN_EXTSN + 10, name = <lldb.comm.debugger.input>
    frame #0: 0x00007fff88a17df2 libsystem_kernel.dylib select$DARWIN_EXTSN + 10
    frame #1: 0x0000000100f3f072 LLDB lldb_private::ConnectionFileDescriptor::BytesAvailable(this=0x000000010524d040, timeout_usec=0x004c4b40, error_ptr=0x0000000105640a18) + 722 at ConnectionFileDescriptor.cpp:542
    frame #2: 0x0000000100f3e6dd LLDB lldb_private::ConnectionFileDescriptor::Read(this=0x000000010524d040, dst=0x0000000105640a60, dst_len=1024, timeout_usec=0x004c4b40, status=0x0000000105640a14, error_ptr=0x0000000105640a18) + 301 at ConnectionFileDescriptor.cpp:273
    frame #3: 0x0000000100f3b8f7 LLDB lldb_private::Communication::ReadFromConnection(this=0x0000000104846270, dst=0x0000000105640a60, dst_len=1024, timeout_usec=0x004c4b40, status=0x0000000105640a14, error_ptr=0x0000000105640a18) + 167 at Communication.cpp:317
    frame #4: 0x0000000100f3b197 LLDB lldb_private::Communication::ReadThread(p=0x0000000104846270) + 327 at Communication.cpp:344
    frame #5: 0x0000000101078923 LLDB ThreadCreateTrampoline(arg=0x00000001045f6650) + 227 at Host.cpp:549
    frame #6: 0x00007fff884aa8bf libsystem_c.dylib _pthread_start + 335
    frame #7: 0x00007fff884adb75 libsystem_c.dylib thread_start + 13

  thread #4: tid = 0x2803, 0x00007fff88a17df2 libsystem_kernel.dylib select$DARWIN_EXTSN + 10, name = <lldb.comm.driver.editline>
    frame #0: 0x00007fff88a17df2 libsystem_kernel.dylib select$DARWIN_EXTSN + 10
    frame #1: 0x0000000100f3f072 LLDB lldb_private::ConnectionFileDescriptor::BytesAvailable(this=0x0000000105700370, timeout_usec=0x004c4b40, error_ptr=0x00000001056c3a18) + 722 at ConnectionFileDescriptor.cpp:542
    frame #2: 0x0000000100f3e6dd LLDB lldb_private::ConnectionFileDescriptor::Read(this=0x0000000105700370, dst=0x00000001056c3a60, dst_len=1024, timeout_usec=0x004c4b40, status=0x00000001056c3a14, error_ptr=0x00000001056c3a18) + 301 at ConnectionFileDescriptor.cpp:273
    frame #3: 0x0000000100f3b8f7 LLDB lldb_private::Communication::ReadFromConnection(this=0x0000000105700000, dst=0x00000001056c3a60, dst_len=1024, timeout_usec=0x004c4b40, status=0x00000001056c3a14, error_ptr=0x00000001056c3a18) + 167 at Communication.cpp:317
    frame #4: 0x0000000100f3b197 LLDB lldb_private::Communication::ReadThread(p=0x0000000105700000) + 327 at Communication.cpp:344
    frame #5: 0x0000000101078923 LLDB ThreadCreateTrampoline(arg=0x0000000105700430) + 227 at Host.cpp:549
    frame #6: 0x00007fff884aa8bf libsystem_c.dylib _pthread_start + 335
    frame #7: 0x00007fff884adb75 libsystem_c.dylib thread_start + 13

  thread #5: tid = 0x2903, 0x00007fff88a17df2 libsystem_kernel.dylib select$DARWIN_EXTSN + 10, name = <lldb.comm.driver.editline_output>
    frame #0: 0x00007fff88a17df2 libsystem_kernel.dylib select$DARWIN_EXTSN + 10
    frame #1: 0x0000000100f3f072 LLDB lldb_private::ConnectionFileDescriptor::BytesAvailable(this=0x00000001057178f0, timeout_usec=0x004c4b40, error_ptr=0x0000000105980a18) + 722 at ConnectionFileDescriptor.cpp:542
    frame #2: 0x0000000100f3e6dd LLDB lldb_private::ConnectionFileDescriptor::Read(this=0x00000001057178f0, dst=0x0000000105980a60, dst_len=1024, timeout_usec=0x004c4b40, status=0x0000000105980a14, error_ptr=0x0000000105980a18) + 301 at ConnectionFileDescriptor.cpp:273
    frame #3: 0x0000000100f3b8f7 LLDB lldb_private::Communication::ReadFromConnection(this=0x0000000105717580, dst=0x0000000105980a60, dst_len=1024, timeout_usec=0x004c4b40, status=0x0000000105980a14, error_ptr=0x0000000105980a18) + 167 at Communication.cpp:317
    frame #4: 0x0000000100f3b197 LLDB lldb_private::Communication::ReadThread(p=0x0000000105717580) + 327 at Communication.cpp:344
    frame #5: 0x0000000101078923 LLDB ThreadCreateTrampoline(arg=0x00000001057179b0) + 227 at Host.cpp:549
    frame #6: 0x00007fff884aa8bf libsystem_c.dylib _pthread_start + 335
    frame #7: 0x00007fff884adb75 libsystem_c.dylib thread_start + 13

  thread #6: tid = 0x2a03, 0x00007fff88a18af2 libsystem_kernel.dylib read + 10, name = <lldb.driver.commandline_io>
    frame #0: 0x00007fff88a18af2 libsystem_kernel.dylib read + 10
    frame #1: 0x0000000100050c3b libedit.3.dylib read_init + 247
    frame #2: 0x0000000100050e96 libedit.3.dylib el_wgetc + 155
    frame #3: 0x000000010005115d libedit.3.dylib el_wgets + 578
    frame #4: 0x000000010005debc libedit.3.dylib el_gets + 37
    frame #5: 0x000000010000d409 lldb IOChannel::LibeditGetInput(this=0x0000000105700490, new_line=0x0000000105a03db0) + 89 at IOChannel.cpp:311
    frame #6: 0x000000010000d8b6 lldb IOChannel::Run(this=0x0000000105700490) + 806 at IOChannel.cpp:391
    frame #7: 0x000000010000d57d lldb IOChannel::IOReadThread(ptr=0x0000000105700490) + 29 at IOChannel.cpp:345
    frame #8: 0x0000000101078923 LLDB ThreadCreateTrampoline(arg=0x00000001057179f0) + 227 at Host.cpp:549
    frame #9: 0x00007fff884aa8bf libsystem_c.dylib _pthread_start + 335
    frame #10: 0x00007fff884adb75 libsystem_c.dylib thread_start + 13
(lldb) 

llvm-svn: 148110
2012-01-13 08:39:16 +00:00
Jim Ingham 5cfbe4aa53 Fix a comment typo.
llvm-svn: 148057
2012-01-12 22:42:34 +00:00
Jim Ingham 50b3d507bd Let the Module FindType do the stripping of namespace components, that's not expensive
and doing it both at the ModuleList and Module levels means we look 4 times for a negative
search.  Also, don't do the search for the stripped name if that is the same as the original
one.

llvm-svn: 148054
2012-01-12 22:35:29 +00:00
Greg Clayton 44435ed07a Big change in the way ObjectFile file contents are managed. We now
mmap() the entire object file contents into memory with MAP_PRIVATE.
We do this because object file contents can change on us and currently
this helps alleviate this situation. It also make the code for accessing
object file data much easier to manage and we don't end up opening the
file, reading some data and closing the file over and over.

llvm-svn: 148017
2012-01-12 05:25:17 +00:00
Greg Clayton 8b35334e0c Fixed a missing space when reporting errors and warning through the module
and also print out the full path and architecture.

llvm-svn: 147908
2012-01-11 01:59:18 +00:00
Greg Clayton 7d7850af64 Since clang modifies .o files in place, use MAP_PRIVATE as it seems
to fix the issues we run into on darwin even though the docs don't
seems to say it will.

llvm-svn: 147835
2012-01-10 02:53:13 +00:00
Greg Clayton 48ca8b8fe2 Recursive calls to ValueObject::GetSummaryAsCString() are causing crashes.
The previous approach to controlling the recursion was doing it from
outside the function which is not reliable. Now it is being done inside
the function. This might not solve all of the crashes that we were seeing
since there are other functions that clear the bit that indicates that
the summary is in the process of being generated, but it might solve some.

llvm-svn: 147741
2012-01-07 20:58:07 +00:00
Greg Clayton 4017fa399b <rdar://problem/10652336>
Fixed a crasher when trying to load an expression prefix file:

% touch /tmp/carp.txt
% xcrun lldb
(lldb) settings set target.expr-prefix /tmp/carp.txt
Segmentation fault

llvm-svn: 147646
2012-01-06 02:01:06 +00:00
Greg Clayton 650e3b014e <rdar://problem/10647191>
Removed an extra call to close that was causing problems and also
now use the Host::File class to open the file.

llvm-svn: 147638
2012-01-06 00:43:54 +00:00
Greg Clayton e38a5edd9e Added code in the Host layer that can report system log messages
so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere.
Changed all needed locations over to using this.

For non-darwin, we log to stderr only. On darwin, we log to stderr _and_
to ASL (Apple System Log facility). This will allow GUI apps to have a place
for these error and warning messages to go, and also allows the command line
apps to log directly to the terminal.

llvm-svn: 147596
2012-01-05 03:57:59 +00:00
Sean Callanan 31a8d051dd Fixed a dangling pointer bug associated with the
result variable on a "finish" statement.  The
ownership of the result value was not being properly
assigned to the newly-created persistent result
variable; now it is.

llvm-svn: 147587
2012-01-05 01:11:09 +00:00
Greg Clayton 96c09687bc <rdar://problem/10507811>
Be better at detecting when DWARF changes and handle this more
gracefully than asserting and exiting.

Also fixed up a bunch of system calls that weren't properly checking
for EINTR.

llvm-svn: 147559
2012-01-04 22:56:43 +00:00
Sean Callanan 06d3d01295 Instead of blindly printing a string when
eFormatCString is specified, I have made
DataExtractor::Dump properly escape the string.
This prevents LLDB from printing characters
that confuse terminals.

llvm-svn: 147536
2012-01-04 17:36:30 +00:00
Greg Clayton 77ccca718d <rdar://problem/10368163>
Watch for empty symbol tables by doing a lot more error checking on
all mach-o symbol table load command values and data that is obtained.
This avoids a crash that was happening when there was no string table.

llvm-svn: 147358
2011-12-30 00:32:24 +00:00
Greg Clayton dcad5021d4 <rdar://problem/10546739>
Fixed SBValue::GetValueAsUnsigned() and SBValue::GetValueAsSigned() calls to
work for bitfields.

llvm-svn: 147332
2011-12-29 01:26:56 +00:00
Jim Ingham ef65160016 Improve the x86_64 return value decoder to handle most structure returns.
Switch from GetReturnValue, which was hardly ever used, to GetReturnValueObject
which is much more convenient.
Return the "return value object" as a persistent variable if requested.

llvm-svn: 147157
2011-12-22 19:12:40 +00:00
Jim Ingham b7c91a27fb Add check for non-NULL Variable with a NULL Type.
llvm-svn: 147149
2011-12-22 17:03:37 +00:00
Johnny Chen fee6e493b0 Work in progress for:
rdar://problem/10577182
Audit lldb API impl for places where we need to perform a NULL check

Add NULL checks for SBDebugger APIs.

llvm-svn: 146917
2011-12-19 22:51:27 +00:00
Jim Ingham 73ca05a2a0 Add the ability to capture the return value in a thread's stop info, and print it
as part of the thread format output.
Currently this is only done for the ThreadPlanStepOut.
Add a convenience API ABI::GetReturnValueObject.
Change the ValueObject::EvaluationPoint to BE an ExecutionContextScope, rather than
trying to hand out one of its subsidiary object's pointers.  That way this will always
be good.

llvm-svn: 146806
2011-12-17 01:35:57 +00:00
Johnny Chen b456b792e0 http://llvm.org/bugs/show_bug.cgi?id=11588
valobj.AddressOf() returns None when an address is expected in a SyntheticChildrenProvider

Patch from Enrico Granata:

The problem was that the frozen object created by the expression parser was a copy of the contents of the StgClosure, rather than a pointer to it. Thus, the expression parser was correctly computing the result of the arithmetic&cast operation along with its address, but only saving it in the live object. This meant that the frozen copy acted as an address-less variable, hence the problem.

The fix attached to this email lets the expression parser store the "live address" in the frozen copy of the address when the object is built without a valid address of its own.
Doing so, along with delegating ValueObjectConstResult to calculate its own address when necessary, solves the issue. I have also added a new test case to check for regressions in this area, and checked that existing test cases pass correctly.

llvm-svn: 146768
2011-12-16 23:04:52 +00:00
Greg Clayton b5c39fe9cc Handle all of the "thumb" target triple architecture variants that llvm
handles.

llvm-svn: 146746
2011-12-16 18:15:52 +00:00
Sean Callanan 50952e9571 I have added a function to SBTarget that allows
clients to disassemble a series of raw bytes as
demonstrated by a new testcase.

In the future, this API will also allow clients
to provide a callback that adds comments for
addresses in the disassembly.

I also modified the SWIG harness to ensure that
Python ByteArrays work as well as strings as
sources of raw data.

llvm-svn: 146611
2011-12-14 23:49:37 +00:00
Johnny Chen c6770763e6 http://llvm.org/bugs/show_bug.cgi?id=11560 lldb::SBTarget::FindFirstType crashes when passed None
Add null checks to several functions.  Plus add test scenario for passing None to SBTarget.FindFirstType(None) and friends.

llvm-svn: 146540
2011-12-14 01:43:31 +00:00
Johnny Chen 64bab4894e rdar://problem/10227672
There were two problems associated with this radar:
1. "settings show target.source-map" failed to show the source-map after, for example,
   "settings set target.source-map /Volumes/data/lldb/svn/trunk/test/source-manager /Volumes/data/lldb/svn/trunk/test/source-manager/hidden"
   has been executed to set the source-map.
2. "list -n main" failed to display the source of the main() function after we properly set the source-map.

The first was fixed by adding the missing functionality to TargetInstanceSettings::GetInstanceSettingsValue (Target.cpp)
and updating the support files PathMappingList.h/.cpp; the second by modifying SourceManager.cpp to fix several places
with incorrect logic.

Also added a test case test_move_and_then_display_source() to TestSourceManager.py, which moves main.c to hidden/main.c,
sets target.source-map to perform the directory mapping, and then verifies that "list -n main" can still show the main()
function.

llvm-svn: 146422
2011-12-12 21:59:28 +00:00
Greg Clayton 6f6bf26a3e <rdar://problem/9958446>
<rdar://problem/10561406>

Stopped the SymbolFileDWARF::FindFunctions (...) from always calculating
the line table entry for all functions that were found. This can slow down
the expression parser if it ends up finding a bunch of matches. Fixed the 
places that were relying on the line table entry being filled in.

Discovered a recursive stack blowout that happened when "main" didn't have
line info for it and there was no line information for "main"

llvm-svn: 146330
2011-12-10 21:05:26 +00:00
Jim Ingham 9ee0115147 Don't try to cache the ExecutionContextScope in the ValueObject::EvaluationPoint, it is too
hard to ensure it doesn't get invalidated out from under us.  Instead look it up from the ThreadID
and StackID when asked for it.
<rdar://problem/10554409>

llvm-svn: 146309
2011-12-10 01:49:43 +00:00
Jim Ingham 60dbabbaa7 Add SBValue::GetDynamicValue and SBValue::GetStaticValue API's.
<rdar://problem/10545069>

llvm-svn: 146173
2011-12-08 19:44:08 +00:00
Greg Clayton 456809c161 Added new symbol types for Objective C classes, metaclasses, and ivars. Each
object file can correctly make these symbols which will abstract us from the
file format and ABI and we can then ask for the objective C class symbol for
a class and find out which object file it was defined in.

llvm-svn: 145744
2011-12-03 02:30:59 +00:00
Greg Clayton 4c3b8fb7e6 <rdar://problem/10410131>
Fixed an issue that could cause an infinite recursion when using "type filter".

llvm-svn: 145720
2011-12-02 22:48:25 +00:00
Greg Clayton 61e7a58c0c Process IDs (lldb::pid_t) and thread IDs (lldb::tid_t) are now 64 bit. This
will allow us to represent a process/thread ID using a pointer for the OS
plug-ins where they might want to represent the process or thread ID using
the address of the process or thread structure.

llvm-svn: 145644
2011-12-01 23:28:38 +00:00
Greg Clayton 1bba2bedde Make sure that we print out function or symbol information. If we disassembled
a symbol, were weren't showing the "<module>`<symbol>" header.

llvm-svn: 145511
2011-11-30 19:36:42 +00:00
Greg Clayton c982b3d6e6 CommandObjectProcess was recently changed to automatically use the platform
to launch a process for debugging. Since this isn't supported on all platforms,
we need to do what we used to do if this isn't supported. I added:

    bool
    Platform::CanDebugProcess ();
    
This will get checked before trying to launch a process for debugging and then
fall back to launching the process through the current host debugger. This
should solve the issue for linux and keep the platform code clean.

Centralized logging code for logging errors, warnings and logs when reporting
things for modules or symbol files. Both lldb_private::Module and 
lldb_private::SymbolFile now have the following member functions:

    void                    
    LogMessage (Log *log, const char *format, ...);

    void
    ReportWarning (const char *format, ...);

    void
    ReportError (const char *format, ...);

These will all output the module name and object (if any) such as:

    "error: lldb.so ...."
    "warning: my_archive.a(foo.o) ...."
    
This will keep the output consistent and stop a lot of logging calls from 
having to try and output all of the information that uniquely identifies
a module or symbol file. Many places in the code were grabbing the path to the
object file manually and if the module represented a .o file in an archive, we
would see log messages like:

    error: foo.a - some error happened

llvm-svn: 145219
2011-11-28 01:45:00 +00:00
Greg Clayton 1abfe04d79 Fixed an issue in the DWARFLocationList::Dump() function where default
arguments were quietly masked as the code changed (modified version of a path
from Dawn).

llvm-svn: 145216
2011-11-28 00:51:27 +00:00
Greg Clayton e372b98d18 Many GDB users always want to display disassembly when they stop by using
something like "display/4i $pc" (or something like this). With LLDB we already
were showing 3 lines of source before and 3 lines of source after the current
source line when showing a stop context. We now improve this by allowing the
user to control the number of lines with the new "stop-line-count-before" and
"stop-line-count-after" settings. Also, there is a new setting for how many
disassembly lines to show: "stop-disassembly-count". This will control how many
source lines are shown when there is no source or when we have no source line
info. 

settings set stop-line-count-before 3
settings set stop-line-count-after 3
settings set stop-disassembly-count 4
settings set stop-disassembly-display no-source

The default values are set as shown above and allow 3 lines of source before 
and after (what we used to do) the current stop location, and will display 4 
lines of disassembly if the source is not available or if we have no debug
info. If both "stop-source-context-before" and "stop-source-context-after" are
set to zero, this will disable showing any source when stopped. The 
"stop-disassembly-display" setting is an enumeration that allows you to control
when to display disassembly. It has 3 possible values:

"never" - never show disassembly no matter what
"no-source" - only show disassembly when there is no source line info or the source files are missing
"always" - always show disassembly.

llvm-svn: 145050
2011-11-21 21:44:34 +00:00
Jim Ingham 9683ff1211 Handle stepping through a trampoline where the jump target is calculated a runtime - and so doesn't match
the name of the PLT entry.  This solution assumes a naming convention agreed upon by us and the system folks,
and isn't general.  The general solution requires actually finding & calling the resolver function if it
hasn't been called yet.  That's more tricky.

llvm-svn: 144981
2011-11-19 00:19:25 +00:00
Greg Clayton e24c4acf6c Fixed the issue that was causing our monitor process threads to crash, it
turned out to be unitialized data in the ProcessLaunchInfo default constructor. 
Turning on MallocScribble in the environment helped track this down. 

When we launch and attach using the host layer, we now inform the process that
it shouldn't detach when by calling an accessor.

llvm-svn: 144882
2011-11-17 04:46:02 +00:00
Greg Clayton 2637f82542 Fixed an issue with the pthread_setspecific() where we weren't NULL-ing out
the thread specific data and were destroying the thread specfic data more
than once.

Also added the ability to ask a lldb::StateType if it is stopped with an
additional paramter of "must_exist" which means that the state must be a
stopped state for a process that still exists. This means that eStateExited
and eStateUnloaded will no longer return true if "must_exist" is set to true.

llvm-svn: 144875
2011-11-17 01:23:07 +00:00
Greg Clayton e4e45924d7 Made the darwin host layer properly reap any child processes that it spawns.
After recent changes we weren't reaping child processes resulting in many
zombie processes. 

This was fixed by adding more settings to the ProcessLaunchOptions class
that allow clients to specify a callback function and baton to be notified
when their process dies. If one is not supplied a default callback will be
used that "does the right thing". 

Cleaned up a race condition in the ProcessGDBRemote class that would attempt
to monitor when debugserver died. 

Added an extra boolean to the process monitor callbacks that indicate if a
process exited or not. If your process exited with a zero exit status and no
signal, both items could be zero.

Modified the process monitor functions to not require a callback function
in order to reap the child process.

llvm-svn: 144780
2011-11-16 05:37:56 +00:00
Greg Clayton 02947e04f6 Speed improvements for ULEB128 reading from James McIlree.
llvm-svn: 144581
2011-11-14 22:56:58 +00:00
Greg Clayton 6f4c06069c Fixed the eFormatChar, eFormatCharPrintable and eFormatCharArray to print
things out correctly again.

llvm-svn: 144261
2011-11-10 03:38:56 +00:00
Jason Molenda e519824641 Bitfields in uint8_t's will have format eFormatChar and DataExtractor::Dump
doesn't handle bitfields in eFormatChar's correctly, only eFormatUnsigned.
Fix DataExtractor::Dump to dump the bitfield eFormatChars correctly.

llvm-svn: 144069
2011-11-08 03:52:17 +00:00
Sean Callanan bfb237bc02 Updated LLVM/Clang to pick up a fix for imports of
C++ vtables, fixing a record layout problem in the
expression parser.

Also fixed various problems with the generation 
and unpacking of llvm.zip given our new better
handling of multiple architectures in the LLVM
build.

(And added a log message that will hopefully catch
record layout problems in the future.)

llvm-svn: 143741
2011-11-04 22:46:46 +00:00
Greg Clayton dce502ede0 Fixed the Xcode project building of LLVM to be a bit more user friendly:
- If you download and build the sources in the Xcode project, x86_64 builds
  by default using the "llvm.zip" checkpointed LLVM.
- If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the
  Xcode project will download the right LLVM sources and build them from 
  scratch
- If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib"
  directory, we will use the sources you have placed in the LLDB directory.
  
Python can now be disabled for platforms that don't support it. 

Changed the way the libllvmclang.a files get used. They now all get built into
arch specific directories and never get merged into universal binaries as this
was causing issues where you would have to go and delete the file if you wanted
to build an extra architecture slice.

llvm-svn: 143678
2011-11-04 03:34:56 +00:00
Jim Ingham 549f737453 We can't have the global vector of modules be a static object, or it might get destroyed
before all the modules, which will then crash when the next modules tries to take itself off it.

llvm-svn: 143402
2011-10-31 23:47:10 +00:00
Jim Ingham 56bbb88689 ValueObjectVariable::GetClangAST should check that it has a valid Type before accessing it.
llvm-svn: 143393
2011-10-31 23:06:45 +00:00
Daniel Dunbar 0d23d03b7c warnings: Fix a non-standard escape sequence.
llvm-svn: 143386
2011-10-31 22:51:02 +00:00
Daniel Dunbar 108228bf5b warnings: Fix use of a non-standard escape.
llvm-svn: 143385
2011-10-31 22:51:00 +00:00
Daniel Dunbar a08823fd10 warnings: Fix a bunch of -Wreorder problems.
llvm-svn: 143381
2011-10-31 22:50:49 +00:00
Daniel Dunbar f9f7032b5d warnings: Fix up several const qualified return types.
llvm-svn: 143379
2011-10-31 22:50:37 +00:00
Jason Molenda ada22aa0e9 finish removal of alpha arch -- previous half-removal caused lldb to assert on startup
llvm-svn: 143294
2011-10-29 20:32:56 +00:00
Jason Molenda 2fae235365 Remove alpha from list of known architectures -- it was just removed
from llvm TOT.

llvm-svn: 143273
2011-10-29 01:34:50 +00:00
Greg Clayton 1848afbbe8 Fixed the continuation dumping of instructions to properly advance the
previous address only by the number of bytes consumed by the disassembly:

(lldb) x/4i 0x0000000100000ea9
0x100000ea9:  66 c7 45 fa 10 00     movw   $16, -6(%rbp)
0x100000eaf:  c7 45 f4 20 00 00 00  movl   $32, -12(%rbp)
0x100000eb6:  e8 47 00 00 00        callq  0x0000000100000f02       ; void f<nullptr_t>(nullptr_t)
0x100000ebb:  8b 45 fc              movl   -4(%rbp), %eax
(lldb) 
0x100000ebe:  48 83 c4 10  addq   $16, %rsp
0x100000ec2:  5d           popq   %rbp
0x100000ec3:  c3           ret    
0x100000ec4:  90           nop    
(lldb) 
0x100000ec5:  90  nop    
0x100000ec6:  90  nop    
0x100000ec7:  90  nop    
0x100000ec8:  90  nop    
(lldb) 
0x100000ec9:  90  nop    
0x100000eca:  90  nop    
0x100000ecb:  90  nop    
0x100000ecc:  90  nop    
(lldb) 
0x100000ecd:  90  nop    
0x100000ece:  90  nop    
0x100000ecf:  90  nop    
0x100000ed0:  55  pushq  %rbp

llvm-svn: 143254
2011-10-28 23:44:55 +00:00
Jim Ingham c6674fd597 Added the ability for the target to specify Modules that will not be searched
when setting breakpoints, but only if no module is specified.  The Darwin 
platform uses this to not set breakpoints in dyld.

llvm-svn: 143249
2011-10-28 23:14:11 +00:00
Greg Clayton 5009f9d501 Added support for the new ".apple_objc" accelerator tables. These tables are
in the same hashed format as the ".apple_names", but they map objective C
class names to all of the methods and class functions. We need to do this 
because in the DWARF the methods for Objective C are never contained in the
class definition, they are scattered about at the translation unit level and
they don't even have attributes that say the are contained within the class
itself. 

Added 3 new formats which can be used to display data:

    eFormatAddressInfo
    eFormatHexFloat
    eFormatInstruction
    
eFormatAddressInfo describes an address such as function+offset and file+line,
or symbol + offset, or constant data (c string, 2, 4, 8, or 16 byte constants).
The format character for this is "A", the long format is "address".

eFormatHexFloat will print out the hex float format that compilers tend to use.
The format character for this is "X", the long format is "hex float".

eFormatInstruction will print out disassembly with bytes and it will use the
current target's architecture. The format character for this is "i" (which
used to be being used for the integer format, but the integer format also has
"d", so we gave the "i" format to disassembly), the long format is 
"instruction".

Mate the lldb::FormatterChoiceCriterion enumeration private as it should have
been from the start. It is very specialized and doesn't belong in the public 
API.

llvm-svn: 143114
2011-10-27 17:55:14 +00:00
Greg Clayton 63f8cc6aca Fixed the display of OSTypes (the four character codes).
llvm-svn: 143056
2011-10-26 21:01:16 +00:00
Greg Clayton 86edbf41d1 Cleaned up many error codes. For any who is filling in error strings into
lldb_private::Error objects the rules are:
- short strings that don't start with a capitol letter unless the name is a
  class or anything else that is always capitolized
- no trailing newline character
- should be one line if possible

Implemented a first pass at adding "--gdb-format" support to anything that
accepts format with optional size/count.

llvm-svn: 142999
2011-10-26 00:56:27 +00:00
Benjamin Kramer 1695466fe3 Move Python.h includes out of the headers into the .cpp file where it's actually used.
Python.h includes a ton of macros that can cause weird behavior down the road.

llvm-svn: 142754
2011-10-23 16:49:03 +00:00
Greg Clayton 81c22f6104 Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for
Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
the type ID was the DIE offset in the DWARF for the .o file which is not
unique across all .o files, so now the SymbolFileDWARFDebugMap class will
make the .o file index part (the high 32 bits) of the unique type identifier
so it can uniquely identify the types.

llvm-svn: 142534
2011-10-19 18:09:39 +00:00
Greg Clayton 5a31471e72 Added the ability to run expressions in any command. Expressions can be
inserted in commands by using backticks:

(lldb) memory read `$rsp-16` `$rsp+16`
(lldb) memory read  -c `(int)strlen(argv[0])` `argv[0]`

The result of the expression will be inserted into the command as a sort of
preprocess stage where this gets done first. We might need to tweak where this
preprocess stage goes, but it is very functional already.

Added ansi color support to the Debugger::FormatPrompt() so you can use things
like "${ansi.fg.blue}" and "${ansi.bold}" many more. This helps in adding 
colors to your prompts without needing to know the ANSI color code strings.

llvm-svn: 141948
2011-10-14 07:41:33 +00:00
Sean Callanan b96ff33b0e Removed namespace qualification from symbol queries.
llvm-svn: 141866
2011-10-13 16:49:47 +00:00
Sean Callanan 213fdb8bf6 Completed the glue that passes a ClangNamespaceDecl *
down through Module and SymbolVendor into SymbolFile.
Added checks to SymbolFileDWARF that restrict symbol
searches when a namespace is passed in.

llvm-svn: 141847
2011-10-13 01:49:10 +00:00
Sean Callanan b6d70ebc0a Added ClangNamespaceDecl * parameters to several
core Module functions that the expression parser
will soon be using.

llvm-svn: 141766
2011-10-12 02:08:07 +00:00
Greg Clayton d4e2552c73 Fix preprocessor warnings for no newline at the end of the source files.
llvm-svn: 141755
2011-10-12 00:53:29 +00:00
Jim Ingham f3277750df Don't look up main to find the default source file till somebody actually asks for it.
llvm-svn: 141422
2011-10-07 22:16:04 +00:00
Greg Clayton cf0e4f0daf Re-organized the contents of RangeMap.h to be more concise and also allow for a Range, RangeArray, RangeData (range + data), or a RangeDataArray. We have many range implementations in LLDB and I will be converting over to using the classes in RangeMap.h so we can have one set of code that does ranges and searching of ranges.
Fixed up DWARFDebugAranges to use the new range classes.

Fixed the enumeration parsing to take a lldb_private::Error to avoid a lot of duplicated code. Now when an invalid enumeration is supplied, an error will be returned and that error will contain a list of the valid enumeration values.

llvm-svn: 141382
2011-10-07 18:58:12 +00:00
Greg Clayton 8dd5c17d69 Stop empty C strings in summaries from showing "<data not available>" when a
"const char *" is NULL. Also cleaned up the display of strings when you have
an array of chars that are all NULL. Previously we were showing: ""...
We now show: ""

llvm-svn: 141223
2011-10-05 22:19:51 +00:00
Greg Clayton bdf3162f53 Fixed an issue where a variable whose value is in a register might end up
not saying that its children are load addresses.

llvm-svn: 140921
2011-10-01 01:53:20 +00:00
Greg Clayton 1ed54f50c5 Cleaned up the the code that figures out the inlined stack frames given a
symbol context that represents an inlined function. This function has been
renamed internally to:

bool
SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, 
                                        SymbolContext &next_frame_sc, 
                                        Address &next_frame_pc) const;
                                        
And externally to:

SBSymbolContext
SBSymbolContext::GetParentOfInlinedScope (const SBAddress &curr_frame_pc, 
                                          SBAddress &parent_frame_addr) const;

The correct blocks are now correctly calculated.

Switched the stack backtracing engine (in StackFrameList) and the address
context printing over to using the internal SymbolContext::GetParentOfInlinedScope(...) 
so all inlined callstacks will match exactly.

llvm-svn: 140910
2011-10-01 00:45:15 +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 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
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
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
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
Jason Molenda fd54b368ea Update declarations for all functions/methods that accept printf-style
stdarg formats to use __attribute__ format so the compiler can flag
incorrect uses.  Fix all incorrect uses.  Most of these are innocuous,
a few were resulting in crashes.

llvm-svn: 140185
2011-09-20 21:44:10 +00:00
Jason Molenda 7e589a6011 Change Error::SetErrorStringWithFormat() prototype to use an
__attribute__ format so the compiler knows that this method takes
printf style formatter arguments and checks that it's being used
correctly.  Fix a couple dozen incorrect SetErrorStringWithFormat()
calls throughout the sources.

llvm-svn: 140115
2011-09-20 00:26:08 +00:00
Greg Clayton 762f7135e2 Don't put modules for .o files into the global shared module list. We
used to do this because we needed to find the shared pointer for a .o
file when the .o file's module was needed in a SymbolContext since the
module in a symbol context was a shared pointer. Now that we are using
intrusive pointers we don't have this limitation anymore since any
instrusive shared pointer can be made from a pointer to an object
all on its own.

Also switched over to having the Module and SymbolVendor use shared 
pointers to their object files as had a leak on MacOSX when the 
SymbolVendor's object file wasn't the same as the Module's (debug info
in a stand along file (dSYM file)). Now everything will correctly clean
itself up when the module goes away after an executable gets rebuilt.

Now we correctly get rid of .o files that are used with the DWARF with 
debug map executables on subsequent runs since the only shared pointer
to the object files in from the DWARF symbol file debug map parser, and
when the module gets replaced, it destroys to old one along with all .o 
files. 

Also added a small optimization when using BSD archives where we will
remove old BSD containers from the shared list when they are outdated.

llvm-svn: 140002
2011-09-18 18:59:15 +00:00
Greg Clayton 4d122c4009 Adopt the intrusive pointers in:
lldb_private::Breakpoint
lldb_private::BreakpointLocations
lldb_private::BreakpointSite
lldb_private::Debugger
lldb_private::StackFrame
lldb_private::Thread
lldb_private::Target

llvm-svn: 139985
2011-09-17 08:33:22 +00:00
Greg Clayton a2eee184e0 Removed the function:
ModuleSP
	Module::GetSP();

Since we are now using intrusive ref counts, we can easily turn any
pointer to a module into a shared pointer just by assigning it.
	

llvm-svn: 139984
2011-09-17 07:23:18 +00:00
Greg Clayton 747bcb03d2 Convert lldb::ModuleSP to use an instrusive ref counted pointer.
We had some cases where getting the shared pointer for a module from
the global module list was causing a performance issue when debugging
with DWARF in .o files. Now that the module uses intrusive ref counts,
we can easily convert any pointer to a shared pointer.

llvm-svn: 139983
2011-09-17 06:21:20 +00:00
Jim Ingham 8314c5259d Track whether a process was Launched or Attached to. If Attached, the detach when the debugger is destroyed, rather than killing the process. Also added a Debugger::Clear, which gets called in Debugger::Destroy to deal with all the targets in the Debugger. Also made the Driver's main loop call Destroy on the debugger, rather than just Destroying the currently selected Target's process.
llvm-svn: 139853
2011-09-15 21:36:42 +00:00
Jim Ingham 4d9695a2b6 Fix ArchSpec::operator== to take the Triple into account as well as the Core. Also make the constructors explicit.
llvm-svn: 139762
2011-09-15 01:07:30 +00:00
Jim Ingham e37d605e7d SBSourceManager now gets the real source manager either from the Debugger or Target. Also, move the SourceManager file cache into the debugger
so it can be shared amongst the targets.

llvm-svn: 139564
2011-09-13 00:29:56 +00:00
Greg Clayton 24756648e5 Fixed up the comments in the headerdoc to match the current implementation
of how ConstString objects work, and removed the duplicate and out of date
comments that were in the cpp file.

llvm-svn: 139487
2011-09-12 03:55:58 +00:00
Greg Clayton 38e953dda2 Fixes for Symtab.cpp to take advantage of the new unique C string map
changes that were just submitted.

llvm-svn: 139478
2011-09-11 00:20:09 +00:00
Enrico Granata 78d0638b7d Renaming a bulk of method calls from Get() to something more descriptive
llvm-svn: 139435
2011-09-09 23:33:14 +00:00
Jim Ingham b7f6b2fa3c Move the SourceManager from the Debugger to the Target. That way it can store the per-Target default Source File & Line.
Set the default Source File & line to main (if it can be found.) at startup.  Selecting the current thread & or frame resets 
the current source file & line, and "source list" as well as the breakpoint command "break set -l <NUM>" will use the 
current source file.

llvm-svn: 139323
2011-09-08 22:13:49 +00:00
Enrico Granata 855cd9012c Refactoring of Get() methods in FormatManager/FormatCategory to have explicative names and return shared-pointers instead of bools
Reduced the amount of memory required to avoid loops in DumpPrintableRepresentation() from 32 bits down to 1 bit
 - Additionally, disallowed creating summary strings of the form ${var%S} which did nothing but cause endless loops by definition

llvm-svn: 139201
2011-09-06 22:59:55 +00:00
Enrico Granata 9128ee2f7a Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
   a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
   in frozen objects ; now such reads transparently move from host to target as required
 - as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
   removed code that enabled to recognize an expression result VO as such
 - introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
   representing a T* or T[], and doing dereferences transparently
   in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
 - as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
   en lieu of doing the raw read itself
 - introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
   this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
   in public layer this returns an SBData, just like GetPointeeData()
 - introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
   the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
   of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
 - added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
 of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
 addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types

llvm-svn: 139160
2011-09-06 19:20:51 +00:00
Greg Clayton afacd14b0b Added the ability for DWARF locations to use the ABI plug-ins to resolve
register names when dumping variable locations and location lists. Also did
some cleanup where "int" types were being used for "lldb::RegisterKind"
values.

llvm-svn: 138988
2011-09-02 01:15:17 +00:00
Greg Clayton f39c67685b Forgot to write out the NULL terminator when putting C string value into
a data using DataEncoder.

Added DataEncoder to the lldb-forward.h file.

llvm-svn: 138950
2011-09-01 18:13:54 +00:00
Greg Clayton 9482865f2a Added a DataEncoder class for the new IR evaluation expression parser so it
can reserve a block of memory and store stuff into it.

llvm-svn: 138949
2011-09-01 18:10:09 +00:00
Johnny Chen 24281181bd Micro-optimization: Update the shift amount only when needed.
llvm-svn: 138678
2011-08-26 23:51:22 +00:00
Johnny Chen bbfa68b090 Make ThreadList::GetSelectedThread() select and return the 0th thread if there's no
currently selected thread.  And update the call sites accordingly.

llvm-svn: 138577
2011-08-25 19:38:34 +00:00
Johnny Chen 40e3592961 Initializes (uint64_t)buf variable, patch by Filipe Cabecinhas!
llvm-svn: 138565
2011-08-25 17:40:39 +00:00
Enrico Granata 88da35f881 Improved the user-friendliness of errors shown by the summary feature in certain areas
Renamed format "signed decimal" to be "decimal". "unsigned decimal" remains unchanged:
 - the name "signed decimal" was interfering with symbol %S (use summary) in summary strings.
   because of the way summary strings are implemented, this did not really lead to a bug, but
   simply to performing more steps than necessary to display a summary. this is fixed.
Documentation improvements (more on synthetic children, some information on filters). This is still a WIP.

llvm-svn: 138384
2011-08-23 21:26:09 +00:00
Enrico Granata dc9407308e Additional code cleanups ; Short option name for --python-script in type summary add moved from -s to -o (this is a preliminary step in moving the short option for --summary-string from -f to -s) ; Accordingly updated the test suite
llvm-svn: 138315
2011-08-23 00:32:52 +00:00
Enrico Granata 4b49acc5bb Separated FormatNavigator and FormatManager in two different files ; moved FormatCategoryItem enum out of FormatManager.h as a debugger-wide lldb_private enum ; minor style cleanups
llvm-svn: 138307
2011-08-22 23:45:15 +00:00
Enrico Granata 0a976141c5 More cleanups ; Separated implementation of FormatManager from class DataVisualization as a front-end by using separate .h/.cpp files - Final aim is to break up FormatManager.h/cpp into several separate files
llvm-svn: 138279
2011-08-22 22:03:47 +00:00
Enrico Granata 1d887499c4 Code cleanup and refactoring (round 4):
- FormatCategories now are directly mapped by ConstString objects instead of going through
   const char* -> ConstString -> const char*
 - FormatCategory callback does not pass category name anymore. This is not necessary because
   FormatCategory objects themselves hold their name as a member variable

llvm-svn: 138254
2011-08-22 18:36:52 +00:00
Enrico Granata def5391ae5 - Support for Python namespaces:
If you have a Python module foo, in order to use its contained objects in LLDB you do not need to use
  'from foo import *'. You can use 'import foo', and then refer to items in foo as 'foo.bar', and LLDB
  will know how to resolve bar as a member of foo.
  Accordingly, GNU libstdc++ formatters have been moved from the global namespace to gnu_libstdcpp and a few
  test cases are also updated to reflect the new convention. Python docs suggest using a plain 'import' en lieu of
  'from-import'.

llvm-svn: 138244
2011-08-22 17:34:47 +00:00
Greg Clayton 56d9a1b31b Added a new plug-in type: lldb_private::OperatingSystem. The operating system
plug-ins are add on plug-ins for the lldb_private::Process class that can add
thread contexts that are read from memory. It is common in kernels to have
a lot of threads that are not currently executing on any cores (JTAG debugging
also follows this sort of thing) and are context switched out whose state is
stored in memory data structures. Clients can now subclass the OperatingSystem
plug-ins and then make sure their Create functions correcltly only enable 
themselves when the right binary/target triple are being debugged. The 
operating system plug-ins get a chance to attach themselves to processes just
after launching or attaching and are given a lldb_private::Process object 
pointer which can be inspected to see if the main executable, target triple,
or any shared  libraries match a case where the OS plug-in should be used.
Currently the OS plug-ins can create new threads, define the register contexts
for these threads (which can all be different if desired), and populate and
manage the thread info (stop reason, registers in the register context) as
the debug session goes on.

llvm-svn: 138228
2011-08-22 02:49:39 +00:00
Greg Clayton 756f8ae520 Fixed an issue where even if the communication object had Clear() called on
it, it could try and call through to an installed callback.

llvm-svn: 138146
2011-08-19 23:28:37 +00:00
Enrico Granata d64d0bc0ea - Now using ${var} as the summary for an aggregate type will produce "name-of-type @ object-location" instead of giving an error
e.g. you may get "foo_class @ 0x123456" when typing "type summary add -f ${var} foo_class"
- Added a new special formatting token %T for summaries. This shows the type of the object.
  Using it, the new "type @ location" summary could be manually generated by writing ${var%T} @ ${var%L}
- Bits and pieces required to support "frame variable array[n-m]"
  The feature is not enabled yet because some additional design and support code is required, but the basics
  are getting there
- Fixed a potential issue where a ValueObjectSyntheticFilter was not holding on to its SyntheticChildrenSP
  Because of the way VOSF are being built now, this has never been an actual issue, but it is still sensible for
  a VOSF to hold on to the SyntheticChildrenSP as well as to its FrontEnd

llvm-svn: 138080
2011-08-19 21:13:46 +00:00
Enrico Granata 02b6676d2b Third round of code cleanups:
- reorganizing the PTS (Partial Template Specializations) in FormatManager.h
 - applied a patch by Filipe Cabecinhas to make LLDB compile with GCC
Functional changes:
 - fixed an issue where command type summary add for type "struct Foo" would not match any types.
   currently, "struct" will be stripped off and type "Foo" will be matched.
   similar behavior occurs for class, enum and union specifiers.

llvm-svn: 138020
2011-08-19 01:14:49 +00:00
Enrico Granata 85933ed40c Second round of code cleanups:
- reorganizing classes layout to have public part first
   Typedefs that we want to keep private, but must be defined for some public code to work correctly are an exception
 - avoiding methods in the form T foo() { code; } all on one-line
 - moving method implementations from .h to .cpp whenever feasible
   Templatized code is an exception and so are very small methods
 - generally, adhering to coding conventions followed project-wide
Functional changes:
 - fixed an issue where using ${var} in a summary for an aggregate, and then displaying a pointer-to-aggregate would lead to no summary being displayed
   The issue was not a major one because all ${var} was meant to do in that context was display an error for invalid use of pointer
   Accordingly fixed test cases and added a new test case

llvm-svn: 137944
2011-08-18 16:38:26 +00:00
Enrico Granata c482a19294 First round of code cleanups:
- all instances of "vobj" have been renamed to "valobj"
 - class Debugger::Formatting has been renamed to DataVisualization (defined in FormatManager.h/cpp)
   The interface to this class has not changed
 - FormatCategory now uses ConstString's as keys to the navigators instead of repeatedly casting
   from ConstString to const char* and back all the time
   Next step is making the same happen for categories themselves
 - category gnu-libstdc++ is defined in the constructor for a FormatManager
   The source code for it is defined in gnu_libstdcpp.py, drawn from examples/synthetic at compile time
   All references to previous 'osxcpp' name have been removed from both code and file names
Functional changes:
 - the name of the option to use a summary string for 'type summary add' has changed from the previous --format-string
   to the new --summary-string. It is expected that the short option will change from -f to -s, and -s for --python-script
   will become -o

llvm-svn: 137886
2011-08-17 22:13:59 +00:00
Enrico Granata 217f91fc57 New category "gnu-libstdc++" provides summary for std::string and synthetic children for types std::map, std::list and std::vector
The category is enabled by default. If you run into issues with it, disable it and the previous behavior of LLDB is restored
 ** This is a temporary solution. The general solution to having formatters pulled in at startup should involve going through the Platform.
Fixed an issue in type synthetic list where a category with synthetic providers in it was not shown if all the providers were regex-based

llvm-svn: 137850
2011-08-17 19:07:52 +00:00
Greg Clayton 2d928c4d07 Fixed register value objects to be able to return their values as unsigned
and signed integers.

llvm-svn: 137710
2011-08-16 03:49:01 +00:00
Jason Molenda 311186a6ef Allow for a cpu subtype of 4 to still be recognized as an x86_64
processor; we may get this subtype ("CPU_SUBTYPE_X86_ARCH1") back
when starting a kdp session.

llvm-svn: 137701
2011-08-16 01:23:22 +00:00
Greg Clayton 6fdfc7e443 Fixed an issue where a variable that was a pointer whose
location was in a register would not be able to dereference 
children when displaying "*var" or the derefence of the variable.

llvm-svn: 137695
2011-08-16 00:44:29 +00:00
Greg Clayton 6bc11b2756 Removed debug printf that was left in.
llvm-svn: 137630
2011-08-15 18:24:44 +00:00
Greg Clayton f6a5fc2e8b Patch from Matt Johnson that cleans up usage of APInt
to keep GCC 4.5.2 happy and also to not use a deprecated
llvm API.

llvm-svn: 137605
2011-08-15 07:23:47 +00:00
Greg Clayton 8753c1e057 Added the ability to use llvm::APInt class to view
any integers that are larger than a 8 bytes. We can now
display signed decimal, unsigned decimal, octal, and binary
(we could already view hex before this fix).

llvm-svn: 137602
2011-08-15 02:24:40 +00:00
Greg Clayton 98fcc4e60f Bumped Xcode project versions for lldb-72 and debugserver-143.
llvm-svn: 137547
2011-08-13 01:48:45 +00:00
Jim Ingham 16e0c68627 Make ValueObject::SetValueFromCString work correctly.
Also change the SourceInitFile to look for .lldb-<APPNAME> and source that
preferentially if it exists.
Also made the breakpoint site report its address as well as its breakpoint number
when it gets hit and can't find any the associated locations (usually because the
breakpoint got disabled or deleted programmatically between the time it was hit
and reported.)
Changed ThreadPlanCallFunction to initialize the ivar m_func in the initializers of the
constructor, rather than waiting to initialize till later on in the function.
Fixed a bug where if you make an SBError and the ask it Success, it returns false.
Fixed ValueObject::ResolveValue so that it resolves a temporary value, rather than
overwriting the one in the value object.

llvm-svn: 137536
2011-08-12 23:34:31 +00:00
Greg Clayton 23aca09205 Fixed an incorrect static analyzer fix.
llvm-svn: 137534
2011-08-12 23:32:52 +00:00
Greg Clayton 7e9b1fd045 We were leaking a stack frame in StackFrameList in Thread.cpp which could
cause extra shared pointer references to one or more modules to be leaked.
This would cause many object files to stay around the life of LLDB, so after
a recompile and rexecution, we would keep adding more and more memory. After
fixing the leak, we found many cases where leaked stack frames were still
being used and causing crashes in the test suite. These are now all resolved.

llvm-svn: 137516
2011-08-12 21:40:01 +00:00
Enrico Granata 68eb4bb421 Added an error message when the user tries to add a filter when a synthetic provider for the same type is already defined in the same category
The converse is also true: an error is shown when the user tries to add a synthetic provider to a category that already has a filter for the same type

llvm-svn: 137493
2011-08-12 19:14:27 +00:00
Enrico Granata 61a80ba6c3 Giving a warning to the user the first time children are truncated by the new cap setting
llvm-svn: 137462
2011-08-12 16:42:31 +00:00
Enrico Granata 22c55d180d *Some more optimizations in usage of ConstString
*New setting target.max-children-count gives an upper-bound to the number of child objects that will be displayed at each depth-level
  This might be a breaking change in some scenarios. To override the new limit you can use the --show-all-children (-A) option
  to frame variable or increase the limit in your lldbinit file
*Command "type synthetic" has been split in two:
  - "type synthetic" now only handles Python synthetic children providers
  - the new command "type filter" handles filters
  Because filters and synthetic providers are both ways to replace the children of a ValueObject, only one can be effective at any given time.

llvm-svn: 137416
2011-08-12 02:00:06 +00:00
Johnny Chen ff7f3cd277 Fix a logic error caught by the static analyzer.
llvm-svn: 137407
2011-08-12 01:22:56 +00:00
Johnny Chen ec95565a9d Fix 'Undefined or garbage value returned to caller' (static analyzer).
llvm-svn: 137374
2011-08-11 22:23:44 +00:00
Johnny Chen 3e99bc3a07 Fix a logic error caught by the static analyzer.
llvm-svn: 137334
2011-08-11 19:40:36 +00:00
Johnny Chen 8446277c11 Fix a logic error caught by the static analyzer.
llvm-svn: 137328
2011-08-11 19:12:10 +00:00
Enrico Granata 8c9d35603e Fixed an issue where a pointer's address was being logged instead of its value
Access to synthetic children by name:
 if your object has a synthetic child named foo you can now type
  frame variable object.foo (or ->foo if you have a pointer)
  and that will print the value of the synthetic child
  (if your object has an actual child named foo, the actual child prevails!)
 this behavior should also work in summaries, and you should be able to use
 ${var.foo} and ${svar.foo} interchangeably
  (but using svar.foo will mask an actual child named foo)

llvm-svn: 137314
2011-08-11 17:08:01 +00:00
Greg Clayton 0c02e4eaea Fix the broken build that happened with my last checkin.
llvm-svn: 137300
2011-08-11 04:30:39 +00:00
Greg Clayton aa149cbd86 Added the ability to remove orphaned module shared pointers from a ModuleList.
This is helping us track down some extra references to ModuleSP objects that
are causing things to get kept around for too long. 

Added a module pointer accessor to target and change a lot of code to use 
it where it would be more efficient.

"taret delete" can now specify "--clean=1" which will cleanup the global module
list for any orphaned module in the shared module cache which can save memory
and also help track down module reference leaks like we have now.

llvm-svn: 137294
2011-08-11 02:48:45 +00:00
Greg Clayton 3418c85771 While tracking down memory consumption issue a few things were needed: the
ability to dump more information about modules in "target modules list". We
can now dump the shared pointer reference count for modules, the pointer to
the module itself (in case performance tools can help track down who has
references to said pointer), and the modification time.

Added "target delete [target-idx ...]" to be able to delete targets when they
are no longer needed. This will help track down memory usage issues and help 
to resolve when module ref counts keep getting incremented. If the command gets
no arguments, the currently selected target will be deleted. If any arguments 
are given, they must all be valid target indexes (use the "target list" 
command to get the current target indexes).

Took care of a bunch of "no newline at end of file" warnings.

TimeValue objects can now dump their time to a lldb_private::Stream object.

Modified the "target modules list --global" command to not error out if there
are no targets since it doesn't require a target.

Fixed an issue in the MacOSX DYLD dynamic loader plug-in where if a shared 
library was updated on disk, we would keep using the older one, even if it was
updated.

Don't allow the ModuleList::GetSharedModule(...) to return an empty module.
Previously we could specify a valid path on disc to a module, and specify an
architecture that wasn't contained in that module and get a shared pointer to
a module that wouldn't be able to return an object file or a symbol file. We
now make sure an object file can be extracted prior to adding the shared pointer
to the module to get added to the shared list.

llvm-svn: 137196
2011-08-10 02:10:13 +00:00
Jim Ingham 4b53618247 Move the handling of breakpoint conditions from the Private event loop to the StopInfoBreakpoint::DoActions, which happens as the
event is removed.  Also use the return value of asynchronous breakpoint callbacks, they get checked before, and override the 
breakpoint conditions.

Added ProcessModInfo class, to unify "stop_id generation" and "memory modification generation", and use where needed.

llvm-svn: 137102
2011-08-09 02:12:22 +00:00
Enrico Granata 27b625e12f Basic support for reading synthetic children by index:
if your datatype provides synthetic children, "frame variable object[index]" should now do the right thing
 in cases where the above syntax would have been rejected before, i.e.
  object is not a pointer nor an array (frame variable ignores potential overload of [])
  object is a pointer to an Objective-C class (which cannot be dereferenced)
 expression will still run operator[] if available and complain if it cannot do so
 synthetic children by name do not work yet

llvm-svn: 137097
2011-08-09 01:04:56 +00:00
Greg Clayton 65a0399197 Added a "--global" option to the "target modules list"
command that allows us to see all modules that exist and
their corresponding global shared pointer count. This will
help us track down memory issues when modules aren't being
removed and cleaned up from the module list.

llvm-svn: 137078
2011-08-09 00:01:09 +00:00
Enrico Granata cd1c0236fe fixed a potential memory leak ; small improvement in the formatters lookup algorithm
llvm-svn: 136945
2011-08-04 23:37:18 +00:00
Enrico Granata 5dfd49ccba New formatting symbol %# can be used in summary strings to get the "count of children" of a variable
- accordingly, the test cases for the synthetic providers for the std:: containers have been edited to use
   ${svar%#} instead of ${svar.len} to print out the count of elements ; the .len synthetic child has been
   removed from the synthetic providers
The synthetic children providers for the std:: containers now return None when asked for children indexes >= num_children()
Basic code to support filter names based on regular expressions (WIP)

llvm-svn: 136862
2011-08-04 02:34:29 +00:00
Enrico Granata 6fd87d5d33 APIs to GetValueAsSigned/Unsigned() in SBValue now also accept an SBError parameter to give more info about any problem
The synthetic children providers now use the new (safer) APIs to get the values of objects
As a side effect, fixed an issue in ValueObject where ResolveValue() was not always updating the value before reading it

llvm-svn: 136861
2011-08-04 01:41:02 +00:00
Enrico Granata 7823ee3307 testing for a previous issue where formats in summaries where not enforced in all cases ; removed an unused local variable
llvm-svn: 136785
2011-08-03 16:23:33 +00:00
Enrico Granata 9910bc855d Fixed an issue where the KVO swizzled type would be returned as the dynamic type instead of the actual user-level type
- see the test case in lang/objc/objc-dynamic-value for an example
Objective-C dynamic type lookup now works for every Objective-C type
 - previously, true dynamic lookup was only performed for type id

llvm-svn: 136763
2011-08-03 02:18:51 +00:00
Jim Ingham b53cb271ca Add method Module::IsLoadedInTarget, and then in the MacOS X dynamic loader, after we
have initialized our shared library state, discard all the modules that didn't make
it into the running process.

llvm-svn: 136755
2011-08-03 01:03:17 +00:00
Enrico Granata d8b5fce230 bug fix in SBValue::CreateValueFromAddress() where using the resulting VO as a pointer would crash LLDB ; minor improvements in dynamic formatters lookup
llvm-svn: 136743
2011-08-02 23:12:24 +00:00
Enrico Granata c3e320a7a0 Fixed a bug where a variable could not be formatted in a summary if its datatype already had a custom format
Fixed a bug where Objective-C variables coming out of the expression parser could crash the Python synthetic providers:
 - expression parser output has a "frozen data" component, which is a byte-exact copy of the value (in host memory),
   if trying to read into memory based on the host address, LLDB would crash. we are now passing the correct (target)
   pointer to the Python code
Objective-C "id" variables are now formatted according to their dynamic type, if the -d option to frame variable is used:
 - Code based on the Objective-C 2.0 runtime is used to obtain this information without running code on the target

llvm-svn: 136695
2011-08-02 17:27:39 +00:00
Greg Clayton 92eac7f501 Moved some functionality from ValueObject to ClangASTType.
llvm-svn: 136536
2011-07-29 23:21:00 +00:00
Enrico Granata 6f3533fb1d Public API changes:
- Completely new implementation of SBType
 - Various enhancements in several other classes
Python synthetic children providers for std::vector<T>, std::list<T> and std::map<K,V>:
 - these return the actual elements into the container as the children of the container
 - basic template name parsing that works (hopefully) on both Clang and GCC
 - find them in examples/synthetic and in the test suite in functionalities/data-formatter/data-formatter-python-synth
New summary string token ${svar :
 - the syntax is just the same as in ${var but this new token lets you read the values
   coming from the synthetic children provider instead of the actual children
 - Python providers above provide a synthetic child len that returns the number of elements
   into the container
Full bug fix for the issue in which getting byte size for a non-complete type would crash LLDB
Several other fixes, including:
 - inverted the order of arguments in the ClangASTType constructor
 - EvaluationPoint now only returns SharedPointer's to Target and Process
 - the help text for several type subcommands now correctly indicates argument-less options as such

llvm-svn: 136504
2011-07-29 19:53:35 +00:00
Enrico Granata c53114e30a new flag -P to type synth add lets you type a Python class interactively
added a final newline to fooSynthProvider.py
new option to automatically save user input in InputReaderEZ
checking for NULL pointers in several new places

llvm-svn: 135916
2011-07-25 16:59:05 +00:00
Enrico Granata a37a065c33 Python synthetic children:
- you can now define a Python class as a synthetic children producer for a type
   the class must adhere to this "interface":
        def __init__(self, valobj, dict):
     	def get_child_at_index(self, index):
     	def get_child_index(self, name):
   then using type synth add -l className typeName
   (e.g. type synth add -l fooSynthProvider foo)
   (This is still WIP with lots to be added)
   A small test case is available also as reference

llvm-svn: 135865
2011-07-24 00:14:56 +00:00
Peter Collingbourne 9a8d848caf Add support for platforms without sa_len to SocketAddress, and modify
some code to use it

llvm-svn: 135790
2011-07-22 19:12:42 +00:00
Enrico Granata e992a0899e some editing of data visualization error messages to make them more meaningful
debugging printfs() for data visualization turned into a meaningful log:
 - introduced a new log category `types' in channel `lldb'

llvm-svn: 135773
2011-07-22 17:03:19 +00:00
Enrico Granata d55546b27a when typing a summary string you can use the %S symbol to explicitly indicate that you want the summary to be used to print the target object
(e.g. ${var%S}). this might already be the default if your variable is of an aggregate type
new feature: synthetic filters. you can restrict the number of children for your variables to only a meaningful subset
 - the restricted list of children obeys the typical rules (e.g. summaries prevail over children)
 - one-line summaries show only the filtered (synthetic) children, if you type an expanded summary string, or you use Python scripts, all the real children are accessible
 - to provide a synthetic children list use the "type synth add" command, as in:
   type synth add foo_type --child varA --child varB[0] --child varC->packet->flags[1-4]
   (you can use ., ->, single-item array operator [N] and bitfield operator [N-M]; array slice access is not supported, giving simplified names to expression paths is not supported)
 - a new -S option to frame variable and target variable lets you override synthetic children and instead show real ones

llvm-svn: 135731
2011-07-22 00:16:08 +00:00
Enrico Granata 9df29e32c9 Applied Matt Johnson patch to ValueObject and FormatManager
llvm-svn: 135523
2011-07-19 20:57:44 +00:00
Greg Clayton 9189b20875 Added some more functionality to SocketAddress and modified
ConnectionFileDescriptor to use it.

llvm-svn: 135511
2011-07-19 20:03:42 +00:00
Johnny Chen 4480530a0f Patch by Matt Johnson to silence G++ warnings!
Used hand merge to apply the diffs.  I did not apply the diffs for FormatManager.h and
the diffs for memberwise initialization for ValueObject.cpp because they changed since.
I will ask my colleague to apply them later.

llvm-svn: 135508
2011-07-19 19:48:13 +00:00
Enrico Granata 20edcdbe8a The implementation of categories is now synchronization safe
Code cleanup:
 - The Format Manager implementation is now split between two files: FormatClasses.{h|cpp} where the
   actual formatter classes (ValueFormat, SummaryFormat, ...) are implemented and
   FormatManager.{h|cpp} where the infrastructure classes (FormatNavigator, FormatManager, ...)
   are contained. The wrapper code always remains in Debugger.{h|cpp}
 - Several leftover fields, methods and comments from previous design choices have been removed
type category subcommands (enable, disable, delete) now can take a list of category names as input
 - for type category enable, saying "enable A B C" is the same as saying
    enable C
    enable B
    enable A
   (the ordering is relevant in enabling categories, and it is expected that a user typing
    enable A B C wants to look into category A, then into B, then into C and not the other
    way round)
 - for the other two commands, the order is not really relevant (however, the same inverted ordering
   is used for consistency)

llvm-svn: 135494
2011-07-19 18:03:25 +00:00
Greg Clayton ad440da346 Abstract "struct sockaddr", "struct sockaddr_in", "struct sockaddr_in6" and
"struct sockaddr_storage" into a new host class called SocketAddress. This
will allow us to control the host specific implementations (such as how to
get the length) into a single Host specific class.

llvm-svn: 135488
2011-07-19 16:44:54 +00:00
Greg Clayton a63d08c9ff Modified the LocateMacOSXFilesUsingDebugSymbols(...) function to locate
an executable file if it is right next to a dSYM file that is found using
DebugSymbols. The code also looks into a bundle if the dSYM file is right
next to a bundle.

Modified the MacOSX kernel dynamic loader plug-in to correctly set the load
address for kext sections. This is a tad tricky because of how LLDB chooses
to treat mach-o segments with no name. Also modified the loader to properly
handle the older version 1 kext summary info.

Fixed a crasher in the Mach-o object file parser when it is trying to set
the section size correctly for dSYM sections.

Added packet dumpers to the CommunicationKDP class. We now also properly 
detect address byte sizes based on the cpu type and subtype that is provided.
Added a read memory and read register support to CommunicationKDP. Added a
ThreadKDP class that now uses subclasses of the RegisterContextDarwin_XXX for
arm, i386 and x86_64. 

Fixed some register numbering issues in the RegisterContextDarwin_arm class
and added ARM GDB numbers to the ARM_GCC_Registers.h file.

Change the RegisterContextMach_XXX classes over to subclassing their
RegisterContextDarwin_XXX counterparts so we can share the mach register 
contexts between the user and kernel plug-ins.

llvm-svn: 135466
2011-07-19 03:57:15 +00:00
Enrico Granata 1490c6fd8f Fixed a bug where deleting a regex summary would not immediately reflect in the variables display
The "systemwide summaries" feature has been removed and replaced with a more general and
powerful mechanism.
Categories:
 - summaries can now be grouped into buckets, called "categories" (it is expected that categories
   correspond to libraries and/or runtime environments)
 - to add a summary to a category, you can use the -w option to type summary add and give
   a category name (e.g. type summary add -f "foo" foo_t -w foo_category)
 - categories are by default disabled, which means LLDB will not look into them for summaries,
   to enable a category use "type category enable". once a category is enabled, LLDB will
   look into that category for summaries. the rules are quite trivial: every enabled category
   is searched for an exact match. if an exact match is nowhere to be found, any match is
   searched for in every enabled category (whether it involves cascading, going to base classes,
   ...). categories are searched into the order in which they were enabled (the most recently
   enabled category first, then the second most and so on..)
 - by default, most commands that deal with summaries, use a category named "default" if no
   explicit -w parameter is given (the observable behavior of LLDB should not change when
   categories are not explicitly used)
 - the systemwide summaries are now part of a "system" category

llvm-svn: 135463
2011-07-19 02:34:21 +00:00
Greg Clayton 3a29bdbe9b Added a boolean to the pure virtual lldb_private::Process::CanDebug(...)
method so process plug-ins that are requested by name can answer yes when
asked if they can debug a target that might not have any file in the target.

Modified the ConnectionFileDescriptor to have both a read and a write file
descriptor. This allows us to support UDP, and eventually will allow us to
support pipes. The ConnectionFileDescriptor class also has a file descriptor
type for each of the read and write file decriptors so we can use the correct
read/recv/recvfrom call when reading, or write/send/sendto for writing.

Finished up an initial implementation of UDP where you can use the "udp://"
URL to specify a host and port to connect to:

(lldb) process connect --plugin kdp-remote udp://host:41139

This will cause a ConnectionFileDescriptor to be created that can send UDP
packets to "host:41139", and it will also bind to a localhost port that can
be given out to receive the connectionless UDP reply. 

Added the ability to get to the IPv4/IPv6 socket port number from a 
ConnectionFileDescriptor instance if either file descriptor is a socket.

The ProcessKDP can now successfully connect to a remote kernel and detach
using the above "processs connect" command!!! So far we have the following
packets working:
    KDP_CONNECT
    KDP_DISCONNECT
    KDP_HOSTINFO
    KDP_VERSION
    KDP_REATTACH

Now that the packets are working, adding new packets will go very quickly.

llvm-svn: 135363
2011-07-17 20:36:25 +00:00
Greg Clayton 4df8ddfc97 Completed more work on the KDP darwin kernel debugging Process plug-in.
Implemented connect, disconnect, reattach, version, and hostinfo.

Modified the ConnectionFileDescriptor class to be able to handle UDP. 

Added a new Stream subclass called StreamBuffer that is backed by a
llvm::SmallVector for better efficiency.

Modified the DataExtractor class to have a static function that can
dump hex bytes into a stream. This is currently being used to dump incoming
binary packet data in the KDP plug-in.

llvm-svn: 135338
2011-07-16 03:19:08 +00:00
Enrico Granata 0c5ef693a2 Some descriptive text for the Python script feature:
- help type summary add now gives some hints on how to use it
frame variable and target variable now have a --no-summary-depth (-Y) option:
 - simply using -Y without an argument will skip one level of summaries, i.e.
   your aggregate types will expand their children and display no summary, even
   if they have one. children will behave normally
 - using -Y<int>, as in -Y4, -Y7, ..., will skip as many levels of summaries as
   given by the <int> parameter (obviously, -Y and -Y1 are the same thing). children
   beneath the given depth level will behave normally
 -Y0 is the same as omitting the --no-summary-depth parameter entirely
 This option replaces the defined-but-unimplemented --no-summary

llvm-svn: 135336
2011-07-16 01:22:04 +00:00
Enrico Granata 9dd75c8886 System-wide summaries:
- Summaries for char*, const char* and char[] are loaded at startup as
   system-wide summaries. This means you cannot delete them unless you use
   the -a option to type summary delete/clear
 - You can add your own system-wide summaries by using the -w option to type
   summary add
Several code improvements for the Python summaries feature

llvm-svn: 135326
2011-07-15 23:30:15 +00:00
Greg Clayton 57508026c2 Added the ability to connect using "tcp://<host>:<port>" which is the
same as the old "connect://<host>:<port>". Also added the ability to
connect using "udp://<host>:<port>" which will open a connected 
datagram socket. I need to find a way to specify a non connected
datagram socket as well. 

We might need to start setting some settings in the URL itself, 
maybe something like:

udp://<host>:<port>?connected=yes
udp://<host>:<port>?connected=no

I am open to suggestions for URL settings.

Also did more work on the KDP darwin kernel plug-in.

 

llvm-svn: 135277
2011-07-15 16:31:38 +00:00
Enrico Granata f2bbf717f7 Python summary strings:
- you can use a Python script to write a summary string for data-types, in one of
   three ways:
    -P option and typing the script a line at a time
    -s option and passing a one-line Python script
    -F option and passing the name of a Python function
   these options all work for the "type summary add" command
   your Python code (if provided through -P or -s) is wrapped in a function
   that accepts two parameters: valobj (a ValueObject) and dict (an LLDB
   internal dictionary object). if you use -F and give a function name,
   you're expected to define the function on your own and with the right
   prototype. your function, however defined, must return a Python string
 - test case for the Python summary feature
 - a few quirks:
  Python summaries cannot have names, and cannot use regex as type names
  both issues will be fixed ASAP
major redesign of type summary code:
 - type summary working with strings and type summary working with Python code
   are two classes, with a common base class SummaryFormat
 - SummaryFormat classes now are able to actively format objects rather than
   just aggregating data
 - cleaner code to print descriptions for summaries
the public API now exports a method to easily navigate a ValueObject hierarchy
New InputReaderEZ and PriorityPointerPair classes
Several minor fixes and improvements

llvm-svn: 135238
2011-07-15 02:26:42 +00:00
Enrico Granata f4efecd958 smarter summary strings:
- formats %s %char[] %c and %a now work to print 0-terminated c-strings if they are applied to a char* or char[] even without the [] operator (e.g. ${var%s})
 - array formats (char[], intN[], ..) now work when applied to an array of a scalar type even without the [] operator (e.g. ${var%int32_t[]})
LLDB will not crash because of endless loop when trying to obtain a summary for an object that has no value and references itself in its summary string
In many cases, a wrong summary string will now display an "<error>" message instead of giving out an empty string

llvm-svn: 135007
2011-07-12 22:56:10 +00:00
Enrico Granata f9fa6ee5e3 named summaries:
- a new --name option for "type summary add" lets you give a name to a summary
 - a new --summary option for "frame variable" lets you bind a named summary to one or more variables
${var%s} now works for printing the value of 0-terminated CStrings
type format test case now tests for cascading
 - this is disabled on GCC because GCC may end up stripping typedef chains, basically breaking cascading
new design for the FormatNavigator class
new template class CleanUp2 meant to support cleanup routines with 1 additional parameter beyond resource handle

llvm-svn: 134943
2011-07-12 00:18:11 +00:00
Greg Clayton c749eb89ad Added the ability to see block variables when looking up addresses
with the "target modules lookup --address <addr>" command. The variable
ID's, names, types, location for the address, and declaration is
displayed.

This can really help with crash logs since we get, on MacOSX at least,
the registers for the thread that crashed so it is often possible to
figure out some of the variable contents. 

llvm-svn: 134886
2011-07-11 05:12:02 +00:00
Greg Clayton 45ba854399 Allow the built in ValueObject summary providers for C strings
use lldb_private::Target::ReadMemory(...) to allow constant strings
to be displayed in global variables prior on in between process
execution.

Centralized the variable declaration dumping into:

	bool
	Variable::DumpDeclaration (Stream *s, bool show_fullpaths, bool show_module);

Fixed an issue if you used "target variable --regex <regex>" where the
variable name would not be displayed, but the regular expression would.

Fixed an issue when viewing global variables through "target variable"
might not display correctly when doing DWARF in object files.

llvm-svn: 134878
2011-07-10 19:21:23 +00:00
Greg Clayton daf515fc8a Fixed the global and static variables to always be in scope.
Made it so that you can create synthetic children of array
value objects. This is for creating array members when the
array index is out of range. This comes in handy when you have
a structure definition like:

struct Collection
{
    uint32_t count;
    Item array[0];
};
"array" has 1 item, but many times in practice there are more
items in "item_array".

This allows you to do:

(lldb) target variable g_collection.array[3]

To implement this, the get child at index has been modified
to have a "ignore_array_bounds" boolean that can be set to true.

llvm-svn: 134846
2011-07-09 20:12:33 +00:00
Greg Clayton 5707d224e1 Limit the character array summary to 512 bytes.
llvm-svn: 134827
2011-07-09 17:17:07 +00:00
Greg Clayton 884fb69460 Added the ability to see global variables with a variable expression path so
you can do things like:

(lldb) target variable g_global.a
(lldb) target variable *g_global.ptr
(lldb) target variable g_global.ptr[1]

llvm-svn: 134745
2011-07-08 21:46:14 +00:00
Enrico Granata fc7a7f3b75 final fix for the global constructors issue
new GetValueForExpressionPath() method in ValueObject to navigate expression paths in a more bitfield vs slices aware way
changes to the varformats.html document (WIP)

llvm-svn: 134679
2011-07-08 02:51:01 +00:00
Jason Molenda d9761cd466 Switch to using the S_ISDIR and S_ISREG sys/stat.h macros in
CommandCompletions.cpp and DataBufferMemoryMap.cpp.  The file type
part of the st_mode struct member is not a bitmask.

llvm-svn: 134669
2011-07-08 00:38:03 +00:00
Greg Clayton 644247c1dc Added "target variable" command that allows introspection of global
variables prior to running your binary. Zero filled sections now get
section data correctly filled with zeroes when Target::ReadMemory
reads from the object file section data.

Added new option groups and option values for file lists. I still need
to hook up all of the options to "target variable" to allow more complete
introspection by file and shlib.

Added the ability for ValueObjectVariable objects to be created with
only the target as the execution context. This allows them to be read
from the object files through Target::ReadMemory(...). 

Added a "virtual Module * GetModule()" function to the ValueObject
class. By default it will look to the parent variable object and
return its module. The module is needed when we have global variables
that have file addresses (virtual addresses that are specific to
module object files) and in turn allows global variables to be displayed
prior to running.

Removed all of the unused proxy object support that bit rotted in 
lldb_private::Value.

Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code
with the more efficient "FileSpec::Equal (lhs, rhs)".

Improved logging in GDB remote plug-in.

llvm-svn: 134579
2011-07-07 01:59:51 +00:00
Enrico Granata a7187d0000 bug fix in summary strings:
- ${*var[].something} was not working as expected
options -p and -r now also work for type format add

llvm-svn: 134523
2011-07-06 19:27:11 +00:00
Jim Ingham 89b6109be8 Set the EvaluationPoint's m_thread_id to the RIGHT invalid define...
llvm-svn: 134505
2011-07-06 17:42:14 +00:00
Greg Clayton 262f80df5e Made the string representation for a SBValue return what "frame variable"
would return instead of a less than helpful "name: '%s'" description.

Make sure that when we ask for the error from a ValueObject object we
first update the value if needed.

Cleaned up some SB functions to use internal functions and not re-call
through the public API when possible.

llvm-svn: 134497
2011-07-06 16:49:27 +00:00
Enrico Granata e443ba736b Fixed some format names
llvm-svn: 134492
2011-07-06 15:56:06 +00:00
Greg Clayton 34132754bd Fixed some issues with ARM backtraces by not processing any push/pop
instructions if they are conditional. Also fixed issues where the PC wasn't
getting bit zero stripped for ARM targets when a stack frame was thumb. We
now properly call through the GetOpcodeLoadAddress() functions to make sure
the addresses are properly stripped for any targets that may decorate up
their addresses.

We now don't pass the SIGSTOP signals along. We can revisit this soon, but
currently this was interfering with debugging some older ARM targets that
don't have vCont support in the GDB server.

llvm-svn: 134461
2011-07-06 04:07:21 +00:00
Enrico Granata 9fc1944ece new syntax for summary strings:
- ${*expr} now simply means to dereference expr before actually using it
 - bitfields, array ranges and pointer ranges now work in a (hopefully) more natural and language-compliant way
a new class TypeHierarchyNavigator replicates the behavior of the FormatManager in going through type hierarchies
when one-lining summary strings, children's summaries can be used as well as values

llvm-svn: 134458
2011-07-06 02:13:41 +00:00
Greg Clayton 0c51ac3295 When we use the "fd://%u" for file descriptors, we need to detect if this is
a file or socket. We now make a getsockopt call to check if the fd is a socket.

Also, the previous logic in the GDB communication needs to watch for success
with an error so we can deal with EAGAIN and other normal "retry" error codes.

llvm-svn: 134359
2011-07-02 23:21:06 +00:00
Peter Collingbourne f52f0502ca Fix Linux build errors
llvm-svn: 134347
2011-07-02 20:42:56 +00:00
Enrico Granata 0a3958e046 several improvements to "type summary":
- type names can now be regular expressions (exact matching is done first, and is faster)
 - integral (and floating) types can be printed as bitfields, i.e. ${var[low-high]} will extract bits low thru high of the value and print them
 - array subscripts are supported, both for arrays and for pointers. the syntax is ${*var[low-high]}, or ${*var[]} to print the whole array (the latter only works for statically sized arrays)
 - summary is now printed by default when a summary string references a variable. if that variable's type has no summary, value is printed instead. to force value, you can use %V as a format specifier
 - basic support for ObjectiveC:
  - ObjectiveC inheritance chains are now walked through
  - %@ can be specified as a summary format, to print the ObjectiveC runtime description for an object
 - some bug fixes

llvm-svn: 134293
2011-07-02 00:25:22 +00:00
Greg Clayton e305594277 Centralize all of the type name code so that we always strip the leading
"struct ", "class ", and "union " from the start of any type names that are
extracted from clang QualType objects. I had to fix test suite cases that
were expecting the struct/union/class prefix to be there.

llvm-svn: 134132
2011-06-30 02:28:26 +00:00
Enrico Granata 4becb37e34 This commit adds a new top subcommand "summary" to command type named "type". Currently this command
implements three commands:

type summary add <format> <typename1> [<typename2> ...]
type summary delete <typename1> [<typename2> ...]
type summary list [<typename1> [<typename2>] ...]
type summary clear

This allows you to specify the default format that will be used to display
summaries for variables, shown when you use "frame variable" or "expression", or the SBValue classes.

Examples:
type summary add "x = ${var.x}" Point

type summary list

type summary add --one-liner SimpleType

llvm-svn: 134108
2011-06-29 22:27:15 +00:00
Greg Clayton dea8cb4fe3 Added support for finding and global variables in the SBTarget and SBModule
level in the public API. 

Also modified the ValueObject values to be able to display global variables
without having a valid running process. The globals will read themselves from
the object file section data if there is no process, and from the process if
there is one.

Also fixed an issue where modifications for dynamic types could cause child
values of ValueObjects to not show up if the value was unable to evaluate
itself (children of NULL pointer objects).

llvm-svn: 134102
2011-06-29 22:09:02 +00:00
Greg Clayton b10d72f019 Remove the disassembly option: "eOptionShowCurrentLine" and replaced it with
two:

eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains the current PC (mixed mode only)
eOptionMarkPCAddress    = (1u << 3)  // Mark the disassembly line the contains the PC

This allows mixed mode to show the line that contains the current PC, and it
allows us to mark the PC address in the disassembly if desired. Having these
be separate gives more control on the disassembly output. SBFrame::Disassemble()
doesn't enable any of these options.

llvm-svn: 134019
2011-06-28 19:01:40 +00:00
Jim Ingham d555bacca3 Add support for looking up ivar offset from the ObjC runtime.
llvm-svn: 133831
2011-06-24 22:03:24 +00:00
Greg Clayton bb7f31fa29 Centralized all of the format to c-string and to format character code inside
the FormatManager class. Modified the format arguments in any commands to be
able to use a single character format, or a full format name, or a partial 
format name if no full format names match.

Modified any code that was displaying formats to use the new FormatManager
calls so that our help text and errors never get out of date.

Modified the display of the "type format list" command to be a bit more
human readable by showing the format as a format string rather than the single
character format char.

llvm-svn: 133765
2011-06-23 21:22:24 +00:00
Greg Clayton f60f375250 Another patch from Enrico Granata.
Added a fix for where you might have already displayed something with a given
type, then did a "type format add ...", then you display the type again. This
patch will figure out that the format changed and allow us to display the
type with the correct new format.

llvm-svn: 133743
2011-06-23 18:38:25 +00:00
Greg Clayton 4a33d3188c Committing type format code for Enrico Granata.
This commit adds a new top level command named "type". Currently this command
implements three commands:

type format add <format> <typename1> [<typename2> ...]
type format delete <typename1> [<typename2> ...]
type format list [<typename1> [<typename2>] ...]

This allows you to specify the default format that will be used to display
types when you use "frame variable" or "expression", or the SBValue classes.

Examples:

// Format uint*_t as hex
type format add x uint16_t uint32_t uint64_t

// Format intptr_t as a pointer
type format add p intptr_t

The format characters are the same as "printf" for the most part with many
additions. These format character specifiers are also used in many other 
commands ("frame variable" for one). The current list of format characters
include:

a - char buffer
b - binary
B - boolean
c - char
C - printable char
d - signed decimal
e - float
f - float
g - float
i - signed decimal
I - complex integer
o - octal
O - OSType
p - pointer
s - c-string
u - unsigned decimal
x - hex
X - complex float
y - bytes
Y - bytes with ASCII

llvm-svn: 133728
2011-06-23 17:59:56 +00:00
Greg Clayton 1da6f9d7f1 Fixed an issue where SBFrame::GetDisassembly() was returning disassembly that
contained the current line marker. This is now an option which is not enabled
for the API disassembly call.

llvm-svn: 133597
2011-06-22 01:39:49 +00:00
Greg Clayton c1869a5ee1 Don't print out the baton pointer value for simple Baton classes.
llvm-svn: 133541
2011-06-21 20:47:20 +00:00
Peter Collingbourne ba23ca085f Switch from USEC_PER_SEC/NSEC_PER_SEC/NSEC_PER_USEC to TimeValue constants
Fixes the Linux build.

llvm-svn: 133370
2011-06-18 23:52:14 +00:00
Greg Clayton 4e4294bdee Added a new format for displaying an array of characters: eFormatCharArray
This us useful because sometomes you have to show a single character as: 'a'
(using eFormatChar) and other times you might have an array of single 
charcters for display as: 'a' 'b' 'c', and other times you might want to 
show the contents of buffer of characters that can contain non printable
chars: "\0\x22\n123". 

This also fixes an issue that currently happens when you have a single character
C string (const char *a = "a"; or char b[1] = { 'b' };) that was being output
as "'a'" incorrectly due to the way the eFormatChar format output worked.

llvm-svn: 133316
2011-06-17 23:50:44 +00:00
Greg Clayton 73bf5dbd16 Improved the packet throughput when debugging with GDB remote by over 3x on
darwin (not sure about other platforms).

Modified the communication and connection classes to not require the
BytesAvailable function. Now the "Read(...)" function has a timeout in
microseconds.

Fixed a lot of assertions that were firing off in certain cases and replaced
them with error output and code that can deal with the assertion case.

llvm-svn: 133224
2011-06-17 01:22:15 +00:00
Caroline Tice d61c10bc79 Add 'batch_mode' to CommandInterpreter. Modify InputReaders to
not write output (prompts, instructions,etc.) if the CommandInterpreter
is in batch_mode.

Also, finish updating InputReaders to write to the asynchronous stream,
rather than using the Debugger's output file directly.

llvm-svn: 133162
2011-06-16 16:27:19 +00:00
Greg Clayton 40df35ef1b Explicitly set the value to NULL when adding a string map entry.
llvm-svn: 132823
2011-06-10 00:00:19 +00:00
Greg Clayton c3ae1cefc0 I modified the StringMap that was being used to unique our debugger C strings
to have the value for the map be a "const char *" instead of an unused uint32_t.
This allows us to store the uniqued mangled/demangled counterpart in this map
for mangled names. This also speeds up the mangled/demangled counterpart lookup
that used to be maintained in a STL map by having direct access to the data.
If we eventually need to associate other strings to strings to more data, we
can make the value of the StringMap have a more complex value.

Added the start of a history source and history event class. It isn't being
used by anything yet, but might be shortly.

llvm-svn: 132813
2011-06-09 22:34:34 +00:00
Greg Clayton a658fd26c3 Created a std::string in the base StopInfo class for the description and
cleaned up all base classes that had their own copy. Added a SetDescription
accessor to the StopInfo class.

llvm-svn: 132615
2011-06-04 01:26:29 +00:00
Jim Ingham 5b52f0c785 Added Debugger::GetAsync{Output/Error}Stream, and use it to print parse errors when we go to run a breakpoint condition.
llvm-svn: 132517
2011-06-02 23:58:26 +00:00
Caroline Tice d5a0a01b2d Create new class, InputReaderStack, to better handle
mutexes around input readers and prevent deadlocking; modify
Debugger to use the new class.

llvm-svn: 132475
2011-06-02 19:18:55 +00:00
Greg Clayton 5ad639415f Fix dynamic value objects to do the right thing when the
value fails to evaluate.

llvm-svn: 132354
2011-05-31 20:18:39 +00:00
Greg Clayton 007d5be653 lldb-59.
llvm-svn: 132304
2011-05-30 00:49:24 +00:00
Greg Clayton 15184db092 Protect the input reader stack with a recursive mutex.
llvm-svn: 132301
2011-05-29 23:07:38 +00:00
Greg Clayton 18d85eedda Make sure if an enumeration "settings" value has a valid default setting in
its definition, that the first enumeration doesn't always get used as the
default.

llvm-svn: 132289
2011-05-29 19:21:37 +00:00
Greg Clayton fc3f027d33 Don't have the debugger default to ignoring EOF. This is only what the driver
(or anything running in a terminal) wants. Not what a UI (Xcode) would want 
where it creates a debugger per debug window. The current code had an infinite
loop after a debug session ended. 

llvm-svn: 132280
2011-05-29 04:06:55 +00:00
Greg Clayton c0ea046a80 Fixed an issue that could cause LLDB to spin indefinitely.
llvm-svn: 132270
2011-05-29 00:45:15 +00:00
Greg Clayton f3ef3d2af9 Added new lldb_private::Process memory read/write functions to stop a bunch
of duplicated code from appearing all over LLDB:

lldb::addr_t
Process::ReadPointerFromMemory (lldb::addr_t vm_addr, Error &error);

bool
Process::WritePointerToMemory (lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error);

size_t
Process::ReadScalarIntegerFromMemory (lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error);

size_t
Process::WriteScalarToMemory (lldb::addr_t vm_addr, const Scalar &scalar, uint32_t size, Error &error);

in lldb_private::Process the following functions were renamed:

From:
uint64_t
Process::ReadUnsignedInteger (lldb::addr_t load_addr, 
                              size_t byte_size,
                              Error &error);

To:
uint64_t
Process::ReadUnsignedIntegerFromMemory (lldb::addr_t load_addr, 
                                        size_t byte_size,
                                        uint64_t fail_value, 
                                        Error &error);

Cleaned up a lot of code that was manually doing what the above functions do
to use the functions listed above.

Added the ability to get a scalar value as a buffer that can be written down
to a process (byte swapping the Scalar value if needed):

uint32_t 
Scalar::GetAsMemoryData (void *dst,
                        uint32_t dst_len, 
                        lldb::ByteOrder dst_byte_order,
                        Error &error) const;

The "dst_len" can be smaller that the size of the scalar and the least 
significant bytes will be written. "dst_len" can also be larger and the
most significant bytes will be padded with zeroes. 

Centralized the code that adds or removes address bits for callable and opcode
addresses into lldb_private::Target:

lldb::addr_t
Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;

lldb::addr_t
Target::GetOpcodeLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const;

All necessary lldb_private::Address functions now use the target versions so
changes should only need to happen in one place if anything needs updating.

Fixed up a lot of places that were calling :

addr_t
Address::GetLoadAddress(Target*);

to call the Address::GetCallableLoadAddress() or Address::GetOpcodeLoadAddress()
as needed. There were many places in the breakpoint code where things could
go wrong for ARM if these weren't used.

llvm-svn: 131878
2011-05-22 22:46:53 +00:00
Greg Clayton cff851ab33 Added functions to lldb_private::Address to set an address from a load address
and set the address as an opcode address or as a callable address. This is
needed in various places in the thread plans to make sure that addresses that
might be found in symbols or runtime might already have extra bits set (ARM/Thumb).
The new functions are:

bool
Address::SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);

bool
Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target);

SetCallableLoadAddress will initialize a section offset address if it can,
and if so it might possibly set some bits in the address to make the address
callable (bit zero might get set for ARM for Thumb functions).

SetOpcodeLoadAddress will initialize a section offset address using the
specified target and it will strip any special address bits if needed 
depending on the target.

Fixed the ABIMacOSX_arm::GetArgumentValues() function to require arguments
1-4 to be in the needed registers (previously this would incorrectly fallback
to the stack) and return false if unable to get the register values. The
function was also modified to first look for the generic argument registers
and then fall back to finding the registers by name.

Fixed the objective trampoline handler to use the new Address::SetOpcodeLoadAddress
function when needed to avoid address mismatches when trying to complete 
steps into objective C methods. Make similar fixes inside the
AppleThreadPlanStepThroughObjCTrampoline::ShouldStop() function.

Modified ProcessGDBRemote::BuildDynamicRegisterInfo(...) to be able to deal with
the new generic argument registers.

Modified RNBRemote::HandlePacket_qRegisterInfo() to handle the new generic
argument registers on the debugserver side.

Modified DNBArchMachARM::NumSupportedHardwareBreakpoints() to be able to 
detect how many hardware breakpoint registers there are using a darwin sysctl.
Did the same for hardware watchpoints in 
DNBArchMachARM::NumSupportedHardwareWatchpoints().

llvm-svn: 131834
2011-05-22 04:32:55 +00:00
Greg Clayton 92bb12ca3e Moved a lot of simple functions from StoppointLocation.cpp to be inlined in
StoppointLocation.h.

Added a new lldb_private::Address function:

addr_t
Address::GetOpcodeLoadAddress (Target *target) const;

This will strip any special bits from an address to make sure it is suitable
for use in addressing an opcode. Often ARM addresses have an extra bit zero 
that can be set to indicate ARM vs Thumb addresses (gotten from return address
registers, or symbol addresses that may be marked up specially). We need to 
strip these bits off prior to setting breakpoints, so we can centralized the
place to do this inside the Address class.

llvm-svn: 131658
2011-05-19 18:17:41 +00:00
Greg Clayton 316b460309 Fixed an issue with the sign extend code so it uses the correct m_data member.
llvm-svn: 131613
2011-05-19 00:55:50 +00:00
Greg Clayton e376938e93 Added the ability to sign extend a Scalar at any bit position for integer
types.

Added the abilty to set a RegisterValue type via accessor and enum.

Added the ability to read arguments for a function for ARM if you are on the
first instruction in ABIMacOSX_arm.

Fixed an issue where a file descriptor becoming invalid could cause an 
inifnite loop spin in the libedit thread.

llvm-svn: 131610
2011-05-19 00:17:26 +00:00
Greg Clayton 3f5c08f5c2 Added a function to lldb_private::Address:
addr_t
        Address::GetCallableLoadAddress (Target *target) const;
        
This will resolve the load address in the Address object and optionally
decorate the address up to be able to be called. For all non ARM targets, this
just essentially returns the result of "Address::GetLoadAddress (target)". But
for ARM targets, it checks if the address is Thumb, and if so, it returns
an address with bit zero set to indicate a mode switch to Thumb. This is how
we need function pointers to be for return addresses and when resolving 
function addresses for the JIT. It is also nice to centralize this in one spot
to avoid having multiple copies of this code.

llvm-svn: 131588
2011-05-18 22:01:49 +00:00
Jim Ingham 832332d724 FindFunctions was skipping the include_symbols section if it found a SymbolVendor.
llvm-svn: 131526
2011-05-18 05:02:10 +00:00
Greg Clayton cd482e359e Added a way to resolve an load address from a target:
bool
Address::SetLoadAddress (lldb::addr_t load_addr, Target *target);

Added an == and != operator to RegisterValue.

Modified the ThreadPlanTracer to use RegisterValue objects to store the
register values when single stepping. Also modified the output to be a bit
less wide.

Fixed the ABIMacOSX_arm to not overwrite stuff on the stack. Also made the
trivial function call be able to set the ARM/Thumbness of the target 
correctly, and also sets the return value ARM/Thumbness.

Fixed the encoding on the arm s0-s31 and d16 - d31 registers when the default
register set from a standard GDB server register sets.

llvm-svn: 131517
2011-05-18 01:58:14 +00:00
Greg Clayton d495c5340d Added an allocated memory cache to avoid having to allocate memory over and
over when running JITed expressions. The allocated memory cache will cache 
allocate memory a page at a time for each permission combination and divvy up
the memory and hand it out in 16 byte increments. 

llvm-svn: 131453
2011-05-17 03:37:42 +00:00
Greg Clayton 9a8fa9161f Added generic register numbers for simple ABI argument registers and defined
the appropriate registers for arm and x86_64. The register names for the
arguments that are the size of a pointer or less are all named "arg1", "arg2",
etc. This allows you to read these registers by name:

(lldb) register read arg1 arg2 arg3
...

You can also now specify you want to see alternate register names when executing
the read register command:

(lldb) register read --alternate
(lldb) register read -A

llvm-svn: 131376
2011-05-15 04:12:07 +00:00
Greg Clayton 31f1d2f535 Moved all code from ArchDefaultUnwindPlan and ArchVolatileRegs into their
respective ABI plugins as they were plug-ins that supplied ABI specfic info.

Also hookep up the UnwindAssemblyInstEmulation so that it can generate the
unwind plans for ARM.

Changed the way ABI plug-ins are handed out when you get an instance from
the plug-in manager. They used to return pointers that would be mananged
individually by each client that requested them, but now they are handed out
as shared pointers since there is no state in the ABI objects, they can be
shared.

llvm-svn: 131193
2011-05-11 18:39:18 +00:00
Caroline Tice 9088b06899 Make sure writing asynchronous output only backs up
& overwrites prompt if the IOChannel input reader is the top
input reader.

llvm-svn: 131110
2011-05-09 23:06:58 +00:00
Greg Clayton 7349bd9078 While implementing unwind information using UnwindAssemblyInstEmulation I ran
into some cleanup I have been wanting to do when reading/writing registers.
Previously all RegisterContext subclasses would need to implement:

virtual bool
ReadRegisterBytes (uint32_t reg, DataExtractor &data);

virtual bool
WriteRegisterBytes (uint32_t reg, DataExtractor &data, uint32_t data_offset = 0);

There is now a new class specifically designed to hold register values: 
        lldb_private::RegisterValue
        
The new register context calls that subclasses must implement are:

virtual bool
ReadRegister (const RegisterInfo *reg_info, RegisterValue &reg_value) = 0;

virtual bool
WriteRegister (const RegisterInfo *reg_info, const RegisterValue &reg_value) = 0;

The RegisterValue class must be big enough to handle any register value. The
class contains an enumeration for the value type, and then a union for the 
data value. Any integer/float values are stored directly in an appropriate
host integer/float. Anything bigger is stored in a byte buffer that has a length
and byte order. The RegisterValue class also knows how to copy register value
bytes into in a buffer with a specified byte order which can be used to write
the register value down into memory, and this does the right thing when not
all bytes from the register values are needed (getting a uint8 from a uint32
register value..). 

All RegiterContext and other sources have been switched over to using the new
regiter value class.

llvm-svn: 131096
2011-05-09 20:18:18 +00:00
Jim Ingham 2eec4876a2 Fix an unitialized pointer in ValueObject::CreateChildAtIndex.
llvm-svn: 131039
2011-05-07 00:10:58 +00:00
Greg Clayton b2dcc36c05 Added the ability to cast pointer types to another type, no matter what the
ValueObject is, as long as the ValueObject that is being asked to be casted
is a pointer itself.

llvm-svn: 130966
2011-05-05 23:32:56 +00:00
Jim Ingham 2837b766f5 Change "frame var" over to using OptionGroups (and thus the OptionGroupVariableObjectDisplay).
Change the boolean "use_dynamic" over to a tri-state, no-dynamic, dynamic-w/o running target,
and dynamic with running target.

llvm-svn: 130832
2011-05-04 03:43:18 +00:00
Caroline Tice 4a3533ba7f Remove type cast that was causing compiler warning.
llvm-svn: 130790
2011-05-03 20:58:11 +00:00
Caroline Tice 969ed3d10f This patch captures and serializes all output being written by the
command line driver, including the lldb prompt being output by
editline, the asynchronous process output & error messages, and
asynchronous messages written by target stop-hooks.

As part of this it introduces a new Stream class,
StreamAsynchronousIO.  A StreamAsynchronousIO object is created with a
broadcaster, who will eventually broadcast the stream's data for a
listener to handle, and an event type indicating what type of event
the broadcaster will broadcast.  When the Write method is called on a
StreamAsynchronousIO object, the data is appended to an internal
string.  When the Flush method is called on a StreamAsynchronousIO
object, it broadcasts it's data string and clears the string.

Anything in lldb-core that needs to generate asynchronous output for
the end-user should use the StreamAsynchronousIO objects.

I have also added a new notification type for InputReaders, to let
them know that a asynchronous output has been written. This is to
allow the input readers to, for example, refresh their prompts and
lines, if desired.  I added the case statements to all the input
readers to catch this notification, but I haven't added any code for
handling them yet (except to the IOChannel input reader).

llvm-svn: 130721
2011-05-02 20:41:46 +00:00
Jim Ingham 61be0903e5 Adding support for fetching the Dynamic Value for ObjC Objects.
llvm-svn: 130701
2011-05-02 18:13:59 +00:00
Greg Clayton 2289fa4820 Added the ability to set the Platform path for a module through the SBModule
interface.

Added a quick way to set the platform though the SBDebugger interface. I will
actually an a SBPlatform support soon, but for now this will do.

ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where
<fd> is a file descriptor in the current process. This is handy if you have
services, deamons, or other tools that can spawn processes and give you a
file handle.

llvm-svn: 130565
2011-04-30 01:09:13 +00:00
Greg Clayton e5b3498eef Added the start of the CFI row production using the
emulate instruction classes.

llvm-svn: 130556
2011-04-29 22:50:31 +00:00
Greg Clayton 68ebae61d1 Added the ability to specify dumping options (show types, show location,
depth control, pointer depth, and more) when dumping memory and viewing as
a type.

llvm-svn: 130436
2011-04-28 20:55:26 +00:00
Greg Clayton 84c39663a9 Added a new OptionValue subclass for lldb::Format: OptionValueFormat. Added
new OptionGroup subclasses for:
- output file for use with options: 
        long opts: --outfile <path> --append--output
        short opts: -o <path> -A
        
- format for use with options:
        long opts: --format <format>

- variable object display controls for depth, pointer depth, wether to show
  types, show summary, show location, flat output, use objc "po" style summary.
  
Modified ValueObjectMemory to be able to be created either with a TypeSP or
a ClangASTType.

Switched "memory read" over to use OptionGroup subclasses: one for the outfile
options, one for the command specific options, and one for the format.

llvm-svn: 130334
2011-04-27 22:04:39 +00:00
Greg Clayton 79ea878bf9 Got the EmulateInstruction CFI code a lot closer to producing CFI data.
Switch the EmulateInstruction to use the standard RegisterInfo structure
that is defined in the lldb private types intead of passing the reg kind and
reg num everywhere. EmulateInstruction subclasses also need to provide
RegisterInfo structs given a reg kind and reg num. This eliminates the need
for the GetRegisterName() virtual function and allows more complete information
to be passed around in the read/write register callbacks. Subclasses should
always provide RegiterInfo structs with the generic register info filled in as
well as at least one kind of register number in the RegisterInfo.kinds[] array.

llvm-svn: 130256
2011-04-26 23:48:45 +00:00
Greg Clayton 2ed751bd47 Changed the emulate instruction function to take emulate options which
are defined as enumerations. Current bits include:

        eEmulateInstructionOptionAutoAdvancePC
        eEmulateInstructionOptionIgnoreConditions

Modified the EmulateInstruction class to have a few more pure virtuals that
can help clients understand how many instructions the emulator can handle:

        virtual bool
        SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;


Where instruction types are defined as:

//------------------------------------------------------------------
/// Instruction types
//------------------------------------------------------------------    
typedef enum InstructionType
{
    eInstructionTypeAny,                // Support for any instructions at all (at least one)
    eInstructionTypePrologueEpilogue,   // All prologue and epilogue instructons that push and pop register values and modify sp/fp
    eInstructionTypePCModifying,        // Any instruction that modifies the program counter/instruction pointer
    eInstructionTypeAll                 // All instructions of any kind

}  InstructionType;


This allows use to tell what an emulator can do and also allows us to request
these abilities when we are finding the plug-in interface.

Added the ability for an EmulateInstruction class to get the register names
for any registers that are part of the emulation. This helps with being able
to dump and log effectively.

The UnwindAssembly class now stores the architecture it was created with in
case it is needed later in the unwinding process.

Added a function that can tell us DWARF register names for ARM that goes
along with the source/Utility/ARM_DWARF_Registers.h file: 

        source/Utility/ARM_DWARF_Registers.c
        
Took some of plug-ins out of the lldb_private namespace.

llvm-svn: 130189
2011-04-26 04:39:08 +00:00
Greg Clayton 7be2542fc9 Renamed UnwindAssemblyProfiler to UnwindAssembly along with its source files.
llvm-svn: 130156
2011-04-25 21:14:26 +00:00
Greg Clayton 7e14f91dbd Fixed the SymbolContext::DumpStopContext() to correctly indent and dump
inline contexts when the deepest most block is not inlined.

Added source path remappings to the lldb_private::Target class that allow it
to remap paths found in debug info so we can find source files that are elsewhere
on the current system.

Fixed disassembly by function name to disassemble inline functions that are
inside other functions much better and to show enough context before the
disassembly output so you can tell where things came from.

Added the ability to get more than one address range from a SymbolContext 
class for the case where a block or function has discontiguous address ranges.

llvm-svn: 130044
2011-04-23 02:04:55 +00:00
Jim Ingham 58b59f9522 Fix up how the ValueObjects manage their life cycle so that you can hand out a shared
pointer to a ValueObject or any of its dependent ValueObjects, and the whole cluster will
stay around as long as that shared pointer stays around.

llvm-svn: 130035
2011-04-22 23:53:53 +00:00
Caroline Tice de2fb9cf76 Change code for reading emulation data files to read the new file
format.  (The newly formatted files will go in as a separate commit in a
few minutes).

llvm-svn: 129981
2011-04-22 05:08:45 +00:00
Greg Clayton 385aa28cf6 Did some work on the "register read" command to only show the first register
set by default when dumping registers. If you want to see all of the register
sets you can use the "--all" option:

(lldb) register read --all

If you want to just see some register sets, you can currently specify them
by index:

(lldb) register read --set 0 --set 2

We need to get shorter register set names soon so we can specify the register
sets by name without having to type too much. I will make this change soon.

You can also have any integer encoded registers resolve the address values
back to any code or data from the object files using the "--lookup" option.
Below is sample output when stopped in the libc function "puts" with some
const strings in registers:

Process 8973 stopped
* thread #1: tid = 0x2c03, 0x00007fff828fa30f libSystem.B.dylib`puts + 1, stop reason = instruction step into
  frame #0: 0x00007fff828fa30f libSystem.B.dylib`puts + 1
(lldb) register read --lookup 
General Purpose Registers:
  rax          = 0x0000000100000e98  "----------------------------------------------------------------------"
  rbx          = 0x0000000000000000
  rcx          = 0x0000000000000001  
  rdx          = 0x0000000000000000
  rdi          = 0x0000000100000e98  "----------------------------------------------------------------------"
  rsi          = 0x0000000100800000
  rbp          = 0x00007fff5fbff710
  rsp          = 0x00007fff5fbff280
  r8           = 0x0000000000000040  
  r9           = 0x0000000000000000
  r10          = 0x0000000000000000
  r11          = 0x0000000000000246  
  r12          = 0x0000000000000000
  r13          = 0x0000000000000000
  r14          = 0x0000000000000000
  r15          = 0x0000000000000000
  rip          = 0x00007fff828fa30f  libSystem.B.dylib`puts + 1
  rflags       = 0x0000000000000246  
  cs           = 0x0000000000000027  
  fs           = 0x0000000000000000
  gs           = 0x0000000000000000

As we can see, we see two constant strings and the PC (register "rip") is 
showing the code it resolves to.

I fixed the register "--format" option to work as expected.

Added a setting to disable skipping the function prologue when setting 
breakpoints as a target settings variable:

(lldb) settings set target.skip-prologue false

Updated the user settings controller boolean value handler funciton to be able
to take the default value so it can correctly respond to the eVarSetOperationClear
operation.

Did some usability work on the OptionValue classes.

Fixed the "image lookup" command to correctly respond to the "--verbose" 
option and display the detailed symbol context information when looking up
line table entries and functions by name. This previously was only working
for address lookups.

llvm-svn: 129977
2011-04-22 03:55:06 +00:00
Johnny Chen ea80ba8b97 Use self.TraceOn() API to decide whether to print debug output.
llvm-svn: 129935
2011-04-21 20:27:45 +00:00
Caroline Tice 3ac6711aec Add the infrastructure to test instruction emulations automatically.
The idea is that the instruction to be emulated is actually executed
on the hardware to be emulated, with the before and after state of the
hardware being captured and 'freeze-dried' into .dat files.  The
emulation testing code then loads the before & after state from the
.dat file, emulates the instruction using the before state, and
compares the resulting state to the 'after' state.  If they match, the
emulation is accurate, otherwise there is a problem.

The final format of the .dat files needs a bit more work; the plan is
to generalize them a bit and to convert the plain values to key-value pairs. 
But I wanted to get this first pass committed.

This commit adds arm instruction emulation testing to the testsuite, along with
many initial .dat files.

It also fixes a bug in the llvm disassembler, where 32-bit thumb opcodes
were getting their upper & lower 16-bits reversed.

There is a new Instruction sub-class, that is intended to be loaded
from a .dat file rather than read from an executable.  There is also a
new EmulationStateARM class, for handling the before & after states.
EmulationStates for other architetures can be added later when we
emulate their instructions.

llvm-svn: 129832
2011-04-19 23:30:03 +00:00
Greg Clayton 4c20717a8f General cleanup on the UserSettingsController stuff. There were 5 different
places that were dumping values for the settings. Centralized all of the
value dumping into a single place. When dumping values that aren't strings
we no longer surround the value with single quotes. When dumping values that
are strings, surround the string value with double quotes. When dumping array
values, assume they are always string values, and don't put quotes around
dictionary values.

llvm-svn: 129826
2011-04-19 22:32:36 +00:00
Greg Clayton 176761e530 Added a new option to the "source list" command that allows us to see where
line tables specify breakpoints can be set in the source. When dumping the
source, the number of breakpoints that can be set on a source line are shown
as a prefix:

(lldb) source list -f test.c -l1 -c222 -b
       1   	#include <stdio.h>
       2   	#include <sys/fcntl.h>
       3   	#include <unistd.h>
       4   	int
       5   	sleep_loop (const int num_secs)
[2]    6   	{
       7   	    int i;
[1]    8   	    for (i=0; i<num_secs; ++i)
       9   	    {
[1]    10  	        printf("%d of %i - sleep(1);\n", i, num_secs);
[1]    11  	        sleep(1);       
       12  	    }
       13  	    return 0;
[1]    14  	}
       15  	
       16  	int 
       17  	main (int argc, char const* argv[])
[1]    18  	{
[1]    19  	    printf("Process: %i\n\n", getpid());
[1]    20  	    puts("Press any key to continue..."); getchar();
[1]    21  	    sleep_loop (20);
       22  	    return 12;
[1]    23  	}

Above we can see there are two breakpoints for line 6 and one breakpoint for
lines 8, 10, 11, 14, 18, 19, 20, 21 and 23. All other lines have no line table
entries for them. This helps visualize the data provided in the debug 
information without having to manually dump all line tables. It also includes
all inline breakpoint that may result for a given file which can also be very
handy to see.

llvm-svn: 129747
2011-04-19 04:19:37 +00:00
Greg Clayton 7260f6206f Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the 
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example). 

Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.

We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:

(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000) 
(lldb) target list
Current targets:
  target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
  target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
  frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
  frame #1: 0x0000000100000b64 a.out`start + 52

Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.

llvm-svn: 129695
2011-04-18 08:33:37 +00:00
Jim Ingham 78a685aa2d Add support for "dynamic values" for C++ classes. This currently only works for "frame var" and for the
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
2011-04-16 00:01:13 +00:00
Greg Clayton ab65b34fdc Added auto completion for architecture names and for platforms.
Modified the OptionGroupOptions to be able to specify only some of the options
that should be appended by using the usage_mask in the group defintions and
also provided a way to remap them to a new usage mask after the copy. This 
allows options to be re-used and also targetted for specific option groups.

Modfied the CommandArgumentType to have a new eArgTypePlatform enumeration.
Taught the option parser to be able to automatically use the appropriate
auto completion for a given options if nothing is explicitly specified
in the option definition. So you don't have to specify it in the option
definition tables.

Renamed the default host platform name to "host", and the default platform
hostname to be "localhost".

Modified the "file" and "platform select" commands to make sure all options
and args are good prior to creating a new platform. Also defer the computation
of the architecture in the file command until all options are parsed and the
platform has either not been specified or reset to a new value to avoid
computing the arch more than once.

Switch the PluginManager code over to using llvm::StringRef for string
comparisons and got rid of all the AccessorXXX functions in lieu of the newer
mutex + collection singleton accessors.

llvm-svn: 129483
2011-04-13 22:47:15 +00:00
Greg Clayton 8b82f087a0 Moved the execution context that was in the Debugger into
the CommandInterpreter where it was always being used.

Make sure that Modules can track their object file offsets correctly to
allow opening of sub object files (like the "__commpage" on darwin).

Modified the Platforms to be able to launch processes. The first part of this
move is the platform soon will become the entity that launches your program
and when it does, it uses a new ProcessLaunchInfo class which encapsulates
all process launching settings. This simplifies the internal APIs needed for
launching. I want to slowly phase out process launching from the process
classes, so for now we can still launch just as we used to, but eventually
the platform is the object that should do the launching.

Modified the Host::LaunchProcess in the MacOSX Host.mm to correctly be able
to launch processes with all of the new eLaunchFlag settings. Modified any
code that was manually launching processes to use the Host::LaunchProcess
functions.

Fixed an issue where lldb_private::Args had implicitly defined copy 
constructors that could do the wrong thing. This has now been fixed by adding
an appropriate copy constructor and assignment operator.

Make sure we don't add empty ModuleSP entries to a module list.

Fixed the commpage module creation on MacOSX, but we still need to train
the MacOSX dynamic loader to not get rid of it when it doesn't have an entry
in the all image infos.

Abstracted many more calls from in ProcessGDBRemote down into the 
GDBRemoteCommunicationClient subclass to make the classes cleaner and more
efficient.

Fixed the default iOS ARM register context to be correct and also added support
for targets that don't support the qThreadStopInfo packet by selecting the
current thread (only if needed) and then sending a stop reply packet.

Debugserver can now start up with a --unix-socket (-u for short) and can 
then bind to port zero and send the port it bound to to a listening process
on the other end. This allows the GDB remote platform to spawn new GDB server
instances (debugserver) to allow platform debugging.

llvm-svn: 129351
2011-04-12 05:54:46 +00:00
Stephen Wilson 71c21d18c3 Order of initialization lists.
This patch fixes all of the warnings due to unordered initialization lists.

Patch by Marco Minutoli.

llvm-svn: 129290
2011-04-11 19:41:40 +00:00
Caroline Tice 25d61ac2ed Fix various things in the instruction emulation code:
- Add ability to control whether or not the emulator advances the
    PC register (in the emulation state), if the instruction itself
    does not change the pc value..

    - Fix a few typos in asm description strings.

    - Fix bug in the carry flag calculation.

llvm-svn: 129168
2011-04-08 23:33:06 +00:00
Stephen Wilson 8acdbb8a75 Add missing headers.
Something changed in commit r129112 where a few standard headers vanished from
the include chain when building on Linux.  Fix up by including limits.h for
INT_MAX and PATH_MAX where needed, and stdio.h for printf().

llvm-svn: 129130
2011-04-08 13:36:44 +00:00