Commit Graph

3337 Commits

Author SHA1 Message Date
Greg Clayton cce8671fca Fixed some incorrect return values.
llvm-svn: 139582
2011-09-13 04:03:52 +00:00
Johnny Chen 7313a648e9 Fix compiler warning.
llvm-svn: 139569
2011-09-13 01:15:36 +00:00
Johnny Chen 02ae341043 Add trivial implementation for GetDescription().
llvm-svn: 139568
2011-09-13 01:13:20 +00:00
Jason Molenda 354b9a65f9 In ThreadList::GetSelectedThread, handle the case where we have no
valid threads - can happen if attaching to a process fails in a
certain way.

llvm-svn: 139567
2011-09-13 01:13:16 +00:00
Jason Molenda 542adbfccf Change the macosx Host::FindProcesses() to include all processes
(running under any uid) if lldb is being run as root.  It might be
better to handle this up at the ProcessInstanceInfoMatch class with
its m_match_all_users ivar instead of down here...

llvm-svn: 139566
2011-09-13 00:52:59 +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
Johnny Chen 1e49e5e730 Remove an unnecessary 'else { ... }', which adds to vertical as well as horizontal spans,
from CommandObjectFrame::Execute().

llvm-svn: 139561
2011-09-12 23:58:53 +00:00
Johnny Chen 887062aeb3 Watchpoint WIP:
o Rename from OptionGroupWatchpoint::WatchMode to OptionGroupWatchpoint::WatchType,
  and CommandArgumentType::eArgTypeWatchMode to CommandArgumentType::eArgTypeWatchType.
  Update the sources to reflect the change.

o Add a CreateWatchpointLocation() method to Target class, which is currently not implmeneted
  (returns an empty WatchpointLocationSP object).  Add logic to CommandObjectFrame::Execute()
  to exercise the added API for creating a watchpoint location.

llvm-svn: 139560
2011-09-12 23:38:44 +00:00
Greg Clayton d4a2b37091 Huge memory and performance improvements in the DWARF parser.
Address ranges are now split up into two different tables: 
- one in DWARFDebugInfo that is compile unit specific
- one in each DWARFCompileUnit that has exact function DIE offsets

This helps keep the size of the aranges down since the main table will get
uniqued and sorted and have consecutive ranges merged. We then only parse the
compile unit one on demand once we have determined that a compile unit contains
the address in question. We also now use the .debug_aranges section if there 
is one instead of always indexing the DWARF manually.

NameToDIE now uses a UniqueCStringMap<dw_offset> map instead of a std::map.
std::map is very bulky as each node has 3 pointers and the key and value types.
This gets our NameToDIE entry down to 12 bytes each instead of 48 which saves
us a lot of memory when we have very large DWARF.

DWARFDebugAranges now has a smaller footprint for each range it contains to 
save on memory.

llvm-svn: 139557
2011-09-12 23:21:58 +00:00
Johnny Chen 926d086e9b Fix indentations, add some comments.
llvm-svn: 139534
2011-09-12 20:25:57 +00:00
Greg Clayton 98f8c5252e Added GDB/LLDB commands for the "target stop-hook add" command.
llvm-svn: 139529
2011-09-12 19:56:07 +00:00
Johnny Chen 3a9838c07b Fix a bug in OptionGroupWatchpoint.cpp where the '-w' option arg parsing result was not checked
to effect an early error return.

Plus add logic to 'frame variable' command object to check that when watchpoint option is on,
only one variable with exact name (no regex) is specified as the sole command arg.

llvm-svn: 139524
2011-09-12 19:12:06 +00:00
Greg Clayton a76dd62211 Fixed the header guards.
llvm-svn: 139490
2011-09-12 04:20:38 +00:00
Greg Clayton b14eeddaa1 Fixed the logging output to be done consistently across all plug-ins.
Added a new log category for DWARF called "aranges" to log the parsing
of address ranges.

llvm-svn: 139489
2011-09-12 04:05:41 +00:00
Greg Clayton 6372d1cda2 Changed to using an "operator bool" instead of an "operator void*"
and avoid returning a pointer to the current object. In the new 
"operator bool" implementation, check the filename object first 
since many times we have FileSpec objects with a filename, yet no
directory.

llvm-svn: 139488
2011-09-12 04:00:42 +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
Greg Clayton c0a87652ba Added extra calls to the UniqueCStringMap to allow it to be used
more efficiently when it contains a large number of items. Since
the map is actually a vector of "const char *" and type T values,
it will double in size every time you append to it. The extra
added functions allow the collection to be sized to fit the data
after all entries have been appended, and lookups by name or by
regex have been built in to the class to allow efficient lookup.

llvm-svn: 139477
2011-09-11 00:06:05 +00:00
Greg Clayton 14a3551aea Don't skip the application specific ~/.lldbinit file when the program
name is "lldb". So currently when you startup any application and you
have not specified that you would like to skip loading init files through
the API or from "lldb" options, then LLDB will try and load:

"~/.lldbinit-%s" where %s the basename of your program
"~/.lldbinit"

Then LLDB will load any program specified on the command line and then
source the "./.llbinit" file for any temporary debug session specific
commands.

I want this feature because I have thread and frame formats that do
ANSI color codes that I only want to load when running in a terminal
which is when I am running the "lldb" command line program.

llvm-svn: 139476
2011-09-11 00:01:44 +00:00
Johnny Chen 944cdc09a9 A little bit of cleanup; set watch_mode to eWatchInvalid at the OptionParsingStarting() lifecycle point.
llvm-svn: 139467
2011-09-10 06:22:46 +00:00
Johnny Chen 0a57b2382b Convert OptionGroupVariable.cpp to use the arraysize() template function, as well.
llvm-svn: 139452
2011-09-10 01:19:01 +00:00
Greg Clayton 28469ca3a5 Quick fixes to the PE COFF file loader.
llvm-svn: 139448
2011-09-10 01:04:42 +00:00
Johnny Chen 28dda8eebc Add comment.
llvm-svn: 139447
2011-09-10 01:01:44 +00:00
Johnny Chen 7c575b3b3a Refactoring: replace a bunch of static array size computation or hardcoded constant
with a template function 'arraysize(static_array)', defined in Utils.h.

llvm-svn: 139444
2011-09-10 00:48:33 +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
Johnny Chen b1d7529e57 Add OptionGroupWatchpoint.cpp/.h (preparatory work) for hooking up watchpoint to the 'frame variable' comand.
To watch a variable for read/write, issue:

    frame variable -w read_write

Note that '-w' option is not working yet. :-)

llvm-svn: 139434
2011-09-09 23:25:26 +00:00
Greg Clayton bf2331c491 Added the ability to introspect types thourgh the public SBType interface.
Fixed up many API calls to not be "const" as const doesn't mean anything to
most of our lldb::SB objects since they contain a shared pointer, auto_ptr, or
pointer to the types which circumvent the constness anyway.

llvm-svn: 139428
2011-09-09 23:04:00 +00:00
Johnny Chen 67b20bbbee Reset the debug status register, only if necessary, before we resume,
which saves unnecessary traffic to the kernel.

llvm-svn: 139410
2011-09-09 21:11:25 +00:00
Johnny Chen 6d487a9b77 Fix compiler warnings for GetGDBStoppointType().
llvm-svn: 139402
2011-09-09 20:35:15 +00:00
Greg Clayton f754f88f6d Added first pass at PE COFF file reading support. It parses the sections
correctly, symbols are coming soon. It also needs to be 32/64 bit hardened
with more testing.

llvm-svn: 139401
2011-09-09 20:33:05 +00:00
Enrico Granata 08633eea20 Adding two new options to the 'help' command:
--show-aliases (-a) shows aliases for commands, as well as built-in commands
 --hide-user-defined (-u) hides user defined commands
by default 'help' without arguments does not show aliases anymore. to see them, add --show-aliases
to have only built-in commands appear, use 'help --hide-user-defined' ; there is currently no way to hide
built-in commands from the help output
'help command' is not changed by this commit, and help is shown even if command is an alias and -a is not specified

llvm-svn: 139377
2011-09-09 17:49:36 +00:00
Johnny Chen 8a8ce4ad2f Fixed the error message:
./build-swig-Python.sh: line 76: INTERFACE_FILES: command not found

when running SWIG, which was introduced during the last checkin.

llvm-svn: 139376
2011-09-09 17:37:06 +00:00
Enrico Granata e6c42ad243 Objective-C runtime wrapper
llvm-svn: 139372
2011-09-09 16:47:15 +00:00
Enrico Granata bac233511d Fixing an issue with Python commands defined interactively
llvm-svn: 139345
2011-09-09 01:41:30 +00:00
Johnny Chen f2bd6a3984 Patch from Pilipe to allow "target create" on the remote-macosx platform!
llvm-svn: 139342
2011-09-09 00:20:12 +00:00
Johnny Chen 13f8dda9bc FreeBSD platform patch from Filipe!
llvm-svn: 139338
2011-09-09 00:10:04 +00:00
Enrico Granata 13f1d56170 Basic infrastructure code to exploit malloc stack logging as available on Mac OS X to track the allocation history of pointers on the target process
llvm-svn: 139337
2011-09-09 00:04:24 +00:00
Johnny Chen e92aa43b3b Patch from Filipe!
One fixes a trailing comma bug (g++ doesn't like them)
The other gets the Error from the result of an expression evaluation and uses it as the error for the Process::LoadImage() method.

llvm-svn: 139336
2011-09-09 00:01:43 +00:00
Johnny Chen 2592b87209 Remove code rot (unused class OptionGroupFrameVariable) from CommandObjectFrameVariable.
Plus minor indentation change.

llvm-svn: 139335
2011-09-08 23:52:06 +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
Johnny Chen 47f43da196 Watchpoint WIP: on the debugger side, create an instance of either
StopInfoTrace or StopInfoWatchpoint based on the exc_sub_code, as well.

llvm-svn: 139315
2011-09-08 20:52:34 +00:00
Greg Clayton dc55a80da3 Added help on stack frame selection compared to GDB and corrected the register
command help to match the current LLDB.

llvm-svn: 139313
2011-09-08 20:14:22 +00:00
Johnny Chen f8f68a132a Added comments about exception code.
llvm-svn: 139294
2011-09-08 17:07:22 +00:00
Johnny Chen af3d4af4eb Add logic to the DNBArchImplX86_64/DNBArchImplI386::NotifyException() callback method
in order to distinguish the real single step exception from a watchpoint exception
which uses the same exc_type of EXC_BREAKPOINT and exc_code of EXC_I386_SGL.

This is done by checking the debug status register to find out whether the watchpoint
data break event has fired, and, if yes, stuff the data break address into the exception's
exc_sub_code field on the debugserver side for lldb to consume on the other end.

llvm-svn: 139274
2011-09-08 01:16:50 +00:00
Jim Ingham 213b454698 "frame select -r" should return an error if you are already at the top of the stack & try to go up or at the bottom and try to go down.
llvm-svn: 139273
2011-09-08 01:15:09 +00:00
Enrico Granata d769c128b6 other documentation changes
llvm-svn: 139271
2011-09-08 00:50:01 +00:00
Enrico Granata 645a763d72 documentation changes (WIP)
llvm-svn: 139249
2011-09-07 19:20:42 +00:00
Johnny Chen ec6a2d3160 Add logic to MachThreadList::GetThreadID() for the use case of setting a watchpoint
(MachThreadList::EnableHardwareWatchpoint()) where the watchpoint is not associated
with a thread and the current thread, if set, is returned, otherwise we return the
first thread.

Plus minor change to RNBRemote::HandlePacket_z() to use the existing macros to check
the validity of break_id/watch_id.

llvm-svn: 139246
2011-09-07 19:03:50 +00:00
Johnny Chen 9d814e0dd2 Minor change: compare the return val of DNBWatchpointSet() against INVALID_NUB_WATCH_ID
to determine its validity.

llvm-svn: 139209
2011-09-07 00:09:23 +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