Commit Graph

743 Commits

Author SHA1 Message Date
Enrico Granata a5d3ba008b <rdar://problem/12462575> Refactoring a block of shared code in the NSString data formatter
llvm-svn: 165557
2012-10-09 22:44:18 +00:00
Greg Clayton 3a18e31945 Added a new "module" log channel which covers module creation, deletion, and common module list actions.
Also added a new option for "log enable" which is "--stack" which will print out a stack backtrace for each log line.

This was used to track down the leaking module issue I fixed last week.

llvm-svn: 165438
2012-10-08 22:41:53 +00:00
Jason Molenda ccd41e55f1 Ran the sources through the compiler with -Wshadow warnings
enabled after we'd found a few bugs that were caused by shadowed
local variables; the most important issue this turned up was
a common mistake of trying to obtain a mutex lock for the scope
of a code block by doing

        Mutex::Locker(m_map_mutex);

This doesn't assign the lock object to a local variable; it is
a temporary that has its dtor called immediately.  Instead,

        Mutex::Locker locker(m_map_mutex);

does what is intended.  For some reason -Wshadow happened to
highlight these as shadowed variables.

I also fixed a few obivous and easy shadowed variable issues
across the code base but there are a couple dozen more that
should be fixed when someone has a free minute.
<rdar://problem/12437585>

llvm-svn: 165269
2012-10-04 22:47:07 +00:00
Enrico Granata 476b9ee82b <rdar://problem/12424824> Making sure that we correctly update our synthetic children provider for NSDictionary - providing better support for dynamic types by letting the filter recalculate itself when the type of the object changes
llvm-svn: 165260
2012-10-04 21:46:06 +00:00
Enrico Granata 7b8c0389e1 <rdar://problem/12424824> Making sure that we correctly update our synthetic children provider for NSArray - the same work will need to be done for NSDictionary
llvm-svn: 165252
2012-10-04 21:04:46 +00:00
Enrico Granata f175ad152c <rdar://problem/12099592> Adding back a bunch of code-running summaries
llvm-svn: 165186
2012-10-03 23:53:45 +00:00
Enrico Granata 83805259e1 <rdar://problem/12408181> Fixing a bug where we would try to look for types in a module, and then fail to look for them anywhere else because the same SymbolContext was being passed everywhere
llvm-svn: 165169
2012-10-03 21:31:35 +00:00
Greg Clayton 548e9a3e61 <rdar://problem/11791234>
Shared libraries on MacOSX were not properly being removed from the shared
module list when re-running a debug session due to an error in:

Module::MatchesModuleSpec()

llvm-svn: 164991
2012-10-02 06:04:17 +00:00
Enrico Granata 83c85e4193 <rdar://problem/12349509> Renaming the structure that we use for NSDictionary children
llvm-svn: 164973
2012-10-01 21:49:10 +00:00
Enrico Granata 6d39077fe7 <rdar://problem/12378910> Fix a bunch of other places where similar problems could happen
llvm-svn: 164871
2012-09-29 00:47:43 +00:00
Enrico Granata 60b81dff85 <rdar://problem/12378910> Fixing a potential crasher in the data formatters where we fail to check for NULL or empty class name
llvm-svn: 164870
2012-09-29 00:45:53 +00:00
Enrico Granata 21dfcd9d41 Implementing plugins that provide commands.
This checkin adds the capability for LLDB to load plugins from external dylibs that can provide new commands
It exports an SBCommand class from the public API layer, and a new SBCommandPluginInterface

There is a minimal load-only plugin manager built into the debugger, which can be accessed via Debugger::LoadPlugin.

Plugins are loaded from two locations at debugger startup (LLDB.framework/Resources/PlugIns and ~/Library/Application Support/LLDB/PlugIns) and more can be (re)loaded via the "plugin load" command

For an example of how to make a plugin, refer to the fooplugin.cpp file in examples/plugins/commands

Caveats:
	Currently, the new API objects and features are not exposed via Python.
	The new commands can only be "parsed" (i.e. not raw) and get their command line via a char** parameter (we do not expose our internal Args object)
	There is no unloading feature, which can potentially lead to leaks if you overwrite the commands by reloading the same or different plugins
	There is no API exposed for option parsing, which means you may need to use getopt or roll-your-own

llvm-svn: 164865
2012-09-28 23:57:51 +00:00
Greg Clayton b5f0feabae Wrapped up the work I am going to do for now for the "add-dsym" or "target symfile add" command.
We can now do:

Specify a path to a debug symbols file:
(lldb) add-dsym <path-to-dsym>

Go and download the dSYM file for the "libunc.dylib" module in your target:
(lldb) add-dsym --shlib libunc.dylib

Go and download the dSYM given a UUID:
(lldb) add-dsym --uuid <UUID>

Go and download the dSYM file for the current frame:
(lldb) add-dsym --frame

llvm-svn: 164806
2012-09-27 22:26:11 +00:00
Greg Clayton c8f814d1df Added the ability to download a symboled executable and symbol file given a UUID.
llvm-svn: 164753
2012-09-27 03:13:55 +00:00
Jason Molenda 5c4210be8e Update the LLDB_DISABLE_PYTHON ifdef in FormatManager::LoadObjCFormatters to
get FormatManager.cpp to build on no-python platforms again.

llvm-svn: 164284
2012-09-20 06:06:59 +00:00
Greg Clayton 9e6cffc9fd A patch that allows for mach-o architectures to be specified as "<number>-<number>" where the first number is the cpu type and the second is the cpu subtype. Also added code to allow use of mach-o architectures that aren't in our tables so that symbolication and static file introspection (crashlogs) can work with them.
llvm-svn: 164258
2012-09-19 22:25:17 +00:00
Greg Clayton 6f4d8af713 <rdar://problem/12125274>
Intentionally leak the module list to avoid unnecessary freeing of modules + object files + symbol files when the program is exiting.

llvm-svn: 164184
2012-09-18 23:50:22 +00:00
Jason Molenda dfa424c593 Allow for numeric cputype-cpusubtype specifications where the subtype is 0. Use errno to
detect strtoul parse failure instead of return value of 0.  <rdar://problem/12198994>

llvm-svn: 164183
2012-09-18 23:27:18 +00:00
Greg Clayton 43e0af06b4 Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. Some platforms don't support this modification.
llvm-svn: 164148
2012-09-18 18:04:04 +00:00
Enrico Granata 97fca507f4 <rdar://problem/11988289> Making C++ synthetic children provider for NSDictionary and related classes
llvm-svn: 164144
2012-09-18 17:43:16 +00:00
Jason Molenda 38f8bbecba Update LLDB_DISABLE_PYTHON #ifdefs in FormatManager.cpp to get it
building on no-Python systems again.

llvm-svn: 163961
2012-09-15 01:59:02 +00:00
Enrico Granata 01fd9804cb Fixing a potential crasher where the new C++ synthetic children can return a NULL FrontEnd and cause LLDB to crash. This patch introduces a dummy front-end which the ValueObjectSynthetic can use lacking a real FrontEnd
llvm-svn: 163946
2012-09-14 22:41:44 +00:00
Sean Callanan 5527442d11 Updated the demangler to take the fix for a crasher.
<rdar://problem/12293231>

llvm-svn: 163864
2012-09-14 00:52:49 +00:00
Enrico Granata 058049cdea Fixing a typo
llvm-svn: 163852
2012-09-13 23:06:00 +00:00
Greg Clayton a12993c930 Fixed an error with a static enum definition where it wasn't NULL terminate and could crash.
llvm-svn: 163851
2012-09-13 23:03:20 +00:00
Enrico Granata b2698cdf59 <rdar://problem/11086338> Implementing support for synthetic children generated by running C++ code instead of Python scripts ; Adding a bunch of value-generating APIs to our private code layer ; Providing synthetic children for NSArray
llvm-svn: 163818
2012-09-13 18:27:09 +00:00
Filipe Cabecinhas d40ca2f581 Make lldb play nicer with C++11 and fix a (maybe impossible to come by) bug.
llvm-svn: 163800
2012-09-13 14:46:00 +00:00
Filipe Cabecinhas dd39395f83 Make size_t known before including cxxabi.h (FreeBSD fix)
llvm-svn: 163640
2012-09-11 18:11:12 +00:00
Greg Clayton 0e3ab7ac5b Fixed some logging messages.
llvm-svn: 163590
2012-09-11 02:28:49 +00:00
Jason Molenda 9a9422a4ff For the eEncodingIEEE754 registers in RegisterValue::SetType,
only accept the first matching type based on lldb's sizeofs.
<rdar://problem/12222109>

llvm-svn: 163285
2012-09-06 02:17:36 +00:00
Enrico Granata d4439aa9ed Implementing an Options class for EvaluateExpression() in order to make the signature more compact and make it easy to 'just run an expression'
llvm-svn: 163239
2012-09-05 20:41:26 +00:00
Enrico Granata 1364311f4d Making the right thing with regards to disabling summaries on LLDB_DISABLE_PYTHON builds
llvm-svn: 163170
2012-09-04 22:04:50 +00:00
Enrico Granata f519628a10 Adding to files that were missing in the previous commit
llvm-svn: 163156
2012-09-04 18:48:21 +00:00
Enrico Granata 3467d80ba3 <rdar://problem/11485744> Implement important data formatters in C++. Have the Objective-C language runtime plugin expose class descriptors objects akin to the objc_runtime.py Pythonic implementation. Rewrite the data formatters for some core Cocoa classes in C++ instead of Python.
llvm-svn: 163155
2012-09-04 18:47:54 +00:00
Greg Clayton 4c05410f8f Made it so changes to the prompt via "settings set prompt" get noticed by the command line.
Added the ability for OptionValueString objects to take flags. The only flag is currently for parsing escape sequences. Not the prompt string can have escape characters translate which will allow colors in the prompt.

Added functions to Args that will parse the escape sequences in a string, and also re-encode the escape sequences for display. This was looted from other parts of LLDB (the Debugger::FormatString() function).

llvm-svn: 163043
2012-09-01 00:38:36 +00:00
Greg Clayton 7036425c59 <rdar://problem/12202862>
Added a fix for incorrect dynamic typing. Before when asking if a C++ class could be dynamic, we would answer yes for incomplete C++ classes. This turned out to have issues where if a class was not virtual, yet had its first ivar be an instance of a virtual class, we would incorrectly say that a class was virtual and we would downcast it to be a pointer to the first ivar. We now ask the class to complete itself prior to answering the question. We need to test the effects on memory of this change prior to submission. It is the safest and best fix, but it does have a potential downside of higher memory consumption.

llvm-svn: 163014
2012-08-31 18:56:24 +00:00
Greg Clayton 1f7460716b <rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". 
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()

Cleaned up header includes a bit as well.

llvm-svn: 162860
2012-08-29 21:13:06 +00:00
Johnny Chen 1083b0dea6 rdar://problem/11374963
Fix a subtle ArchSpec::cores_match() logic issue which prevents the add-dsym command
to add a debug symbol file to one of the target's current modules.

llvm-svn: 162802
2012-08-28 22:53:40 +00:00
Enrico Granata 114bb19d19 Data formatters for libc++ deque and shared/weak ptrs - a contribution by Jared Grubb
llvm-svn: 162680
2012-08-27 17:42:50 +00:00
Sean Callanan 6efc2ba7f8 Changed register ValueObjects to report their
expression path in a way that can actually be
resolved by "expr".

llvm-svn: 162574
2012-08-24 18:21:05 +00:00
Greg Clayton 754a9369db <rdar://problem/12022079>
Added a new "interpreter" properties to encapsulate any properties for the command interpreter. Right now this contains only "expand-regex-aliases", so you can now enable (disabled by default) the echoing of the command that a regular expression alias expands to:

(lldb) b main
Breakpoint created: 1: name = 'main', locations = 1

Note that the expanded regular expression command wasn't shown by default. You can enable it if you want to:

(lldb) settings set interpreter.expand-regex-aliases true
(lldb) b main
breakpoint set --name 'main'
Breakpoint created: 1: name = 'main', locations = 1

Also enabled auto completion for enumeration option values (OptionValueEnumeration) and for boolean option values (OptionValueBoolean).

Fixed auto completion for settings names when nothing has been type (it should show all settings).

llvm-svn: 162418
2012-08-23 00:22:02 +00:00
Greg Clayton 6920b52be6 Remove further outdated "settings" code and also implement a few missing things.
llvm-svn: 162376
2012-08-22 18:39:03 +00:00
Greg Clayton 67cc06366c Reimplemented the code that backed the "settings" in lldb. There were many issues with the previous implementation:
- no setting auto completion
- very manual and error prone way of getting/setting variables
- tons of code duplication
- useless instance names for processes, threads

Now settings can easily be defined like option values. The new settings makes use of the "OptionValue" classes so we can re-use the option value code that we use to set settings in command options. No more instances, just "does the right thing".

llvm-svn: 162366
2012-08-22 17:17:09 +00:00
Jim Ingham 462227b08b Turn on function args by default in thread & frame formats.
<rdar://problem/11703715>

llvm-svn: 161611
2012-08-09 20:29:34 +00:00
Enrico Granata 7ec18e3d10 <rdar://problem/10449092> Adding a new uppercase hex format specifier. This commit also changes the short names for formats so that uppercase hex can be 'X', which was previously assigned to hex float. hex float now has no short name.
llvm-svn: 161606
2012-08-09 19:33:34 +00:00
Sean Callanan bcf897fa89 LLDB no longer prints <no result> by default if
the expression returns nothing.  There is now a
setting, "notify-void."  When the user enables
that setting, lldb prints (void) if an expression's
result is void.  Otherwise, lldb is silent.

<rdar://problem/11225150>

llvm-svn: 161600
2012-08-09 18:18:47 +00:00
Enrico Granata 2b2631c915 <rdar://problem/11505459> Stripping off the object's type from the output of the 'po' command
llvm-svn: 161592
2012-08-09 16:51:25 +00:00
Sean Callanan 9a028519e8 Removed explicit NULL checks for shared pointers
and instead made us use implicit casts to bool.
This generated a warning in C++11.

<rdar://problem/11930775>

llvm-svn: 161559
2012-08-09 00:50:26 +00:00
Greg Clayton fcde4fad2b Fixed the delay that was happening when quitting lldb from the command line. We weren't initializing the command pipes when constructing a ConnectionFileDescriptor with a file descriptor.
llvm-svn: 161533
2012-08-08 22:27:52 +00:00
Sean Callanan bf154daee6 Added a 'void' format so that the user can manually
suppress all non-error output from the "expression"
command.

<rdar://problem/11225150>

llvm-svn: 161502
2012-08-08 17:35:10 +00:00