Commit Graph

340 Commits

Author SHA1 Message Date
Greg Clayton 44148b367f Bumped Xcode project version for lldb-86 and debugserver-151
llvm-svn: 144032
2011-11-07 22:50:17 +00:00
Greg Clayton c64b5c7c47 Xcode project changes to install "lldb" into "/usr/bin" and have LLDB.framework
in "/System/Library/PrivateFrameworks", and also have "lldb" in the Xcode.app
and the LLDB.framework in Xcode.app as well.

llvm-svn: 144030
2011-11-07 22:45:39 +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 9a67c268f8 For "Debug" and "Release" builds, don't build llvm into the $(OBJROOT) since
we often nuke our "build" folder so we can do clean builds. This way if you
are building your own LLVM you won't have to rebuild LLVM when you do remove
your build folder. The new location for the LLVM build is:

lldb/llvm-build

llvm-svn: 143713
2011-11-04 17:36:00 +00:00
Greg Clayton 755c73f1e1 Fixed the LD_DYLIB_INSTALL_NAME to the LLDB.framework.
llvm-svn: 143710
2011-11-04 17:18:16 +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
Greg Clayton e59da1688e Bumping Xcode project versions for lldb-85 and debugserver-150.
llvm-svn: 143587
2011-11-02 23:11:17 +00:00
Greg Clayton 93d217889e Bumped Xcode project version to lldb-84 and debugserver-149.
llvm-svn: 143408
2011-11-01 01:10:56 +00:00
Greg Clayton 9d3d6886e6 Fixed some warnings after enabling some stricter warnings in the Xcode project
settings.

Also fixed an issue where we weren't creating anonymous namepaces correctly:
<rdar://problem/10371295>

llvm-svn: 143403
2011-10-31 23:51:19 +00:00
Greg Clayton c05203ba81 Updated the project to use the "DEVELOPER_DIR" build setting that specifies
the path to the /Developer directory, and also bumped the Xcode project version
for lldb-83 and debugserver-148.

llvm-svn: 143269
2011-10-29 01:19:08 +00:00
Greg Clayton e3c3d724c9 Bumping Xcode project version in mainline to match the latest build that was
submitted.

llvm-svn: 143199
2011-10-28 16:41:16 +00:00
Sean Callanan 5e9e1991e9 Added VerifyDecl, a function that, when LLDB is
linked against a debug LLVM, runs a variety of
functions -- currently just one -- that verify
that the Decls we create are valid.

ClangASTContext now calls this verifier whenever
it adds a Decl to a DeclContext, and the verifier
checks that the AccessSpecifier is sane.

llvm-svn: 143000
2011-10-26 01:06:27 +00:00
Greg Clayton 1deb796238 Updated all commands that use a "--format" / "-f" options to use the new
OptionGroupFormat. Updated OptionGroupFormat to be able to also use the
"--size" and "--count" options. Commands that use a OptionGroupFormat instance
can choose which of the options they want by initializing OptionGroupFormat
accordingly. Clients can either get only the "--format", "--format" + "--size",
or "--format" + "--size" + "--count". This is in preparation for upcoming
chnages where there are alternate ways (GDB format specification) to set a
format. 

llvm-svn: 142911
2011-10-25 06:44:01 +00:00
Greg Clayton 607ddc571e Bumped versions for lldb-81 and debugserver-146.
llvm-svn: 142718
2011-10-22 03:38:38 +00:00
Greg Clayton 97fbc34276 Fixed some issues where we might not have one of the new apple accelerator
tables (like the .apple_namespaces) and it would cause us to index DWARF that
didn't need to be indexed.

Updated the MappedHash.h (generic Apple accelerator table) and the DWARF
specific one (HashedNameToDIE.h) to be up to date with the latest and
greatest hash table format.

llvm-svn: 142627
2011-10-20 22:30:33 +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
Johnny Chen 01a678603a SBValue::Watch() and SBValue::WatchPointee() are now the official API for creating
a watchpoint for either the variable encapsulated by SBValue (Watch) or the pointee
encapsulated by SBValue (WatchPointee).

Removed SBFrame::WatchValue() and SBFrame::WatchLocation() API as a result of that.

Modified the watchpoint related test suite to reflect the change.

Plus replacing WatchpointLocation with Watchpoint throughout the code base.

There are still cleanups to be dome.  This patch passes the whole test suite.
Check it in so that we aggressively catch regressions.

llvm-svn: 141925
2011-10-14 00:42:25 +00:00
Greg Clayton 1b282f9619 Cleaned up the SBWatchpoint public API.
llvm-svn: 141876
2011-10-13 18:08:26 +00:00
Sean Callanan 03267a7068 Oops, committed my local build settings. Fixed that.
llvm-svn: 141784
2011-10-12 17:08:22 +00:00
Sean Callanan 1fd3f4f14c Made FindGlobalVariable() optionally search a specific
module and namespace.  Also made it use FindGlobalVariables()
instead of the more heavyweight 
GetVariablesForVariableExpressionPath().

llvm-svn: 141783
2011-10-12 16:59:31 +00:00
Greg Clayton 2e4b5c0d9d Removed unneeded content.
llvm-svn: 141477
2011-10-08 03:53:14 +00:00
Greg Clayton c26e445403 Since we use address ranges a lot I added a templatized class that allows us to easily control the base address type, the size type, and the data that is stored with each range. It is designed to be populated by appending all needed items, then sorting the resulting list, and optionally minimizing the list when done. I adopted this new list in the DWARFDebugAranges for even further memory savings.
llvm-svn: 141352
2011-10-07 03:58:56 +00:00
Greg Clayton 7f99513e8f Enable all the new accelerator tables if they are present and don't manually
index the DWARF. Also fixed an issue with memory accelerator tables with a
size of 1 where we would loop infinitely.

Added support for parsing the new .apple_namespaces section which gives us a
memory hash table for looking up namespaces.

llvm-svn: 141128
2011-10-04 22:41:51 +00:00
Greg Clayton d74713b18c Bumped Xcode project version for lldb-80 and debugserver-145.
llvm-svn: 140922
2011-10-01 02:01:36 +00:00
Greg Clayton 6535dae3b7 Remove the "-feliminate-unused-debug-types" OTHER_CFLAGS.
llvm-svn: 140893
2011-09-30 22:08:47 +00:00
Greg Clayton 1767440a72 Convert over to the latest and greatest on disc accelerator
hash tables. Renamed the DWARF sections to ".apple_names" and
".apple_types" until we get more buy in from other vendors.

llvm-svn: 140702
2011-09-28 17:06:40 +00:00
Greg Clayton e241bad92b Enable the following CFLAGS in the Xcode project build:
-flimit-debug-info -feliminate-unused-debug-types -Wparentheses

This helps to trim down the debug information size a bit by omitting types
that aren't used.

llvm-svn: 140611
2011-09-27 17:26:03 +00:00
Johnny Chen d4dd7993b5 Export the watchpoint related API (SBWatchpointLocation class and added SBTarget methods)
to the Python interface.

Implement yet another (threre're 3 now) iterator protocol for SBTarget: watchpoint_location_iter(),
to iterate on the available watchpoint locations.  And add a print representation for
SBWatchpointLocation.

Exercise some of these Python API with TestWatchpointLocationIter.py.

llvm-svn: 140595
2011-09-27 01:19:20 +00:00
Johnny Chen 5d0434644c Add SB API class SBWatchpointLocation and some extra methods to the SBTarget class to
iterate on the available watchpoint locations and to perform watchpoint manipulations.

I still need to export the SBWatchpointLocation class as well as the added watchpoint
manipulation methods to the Python interface.  And write test cases for them.

llvm-svn: 140575
2011-09-26 22:40:50 +00:00
Sean Callanan 9bc838415e Factored out handling of the source code for an
expression into a separate class.  This class
encapsulates wrapping the function as needed.  I
am also moving from using booleans to indicate
what the expression's language should be to using
lldb::LanguageType instead.

llvm-svn: 140545
2011-09-26 18:45:31 +00:00
Greg Clayton d9dc52dc4c Added the ability to get all section contents, or the section
contents starting at an offset (2 separate methods). This helps
the scripting interface stay more natural by allowing both from
Python.

Added the ability to dump data with address annotations when
call SBData::GetDescription().

Hooked up the SBSection to the __repr__ so you can print section
objects from within python.

Improved the dumping of symbols from python.

Fixed the .i interface references which were set to "Relative to this Group"
which somehow included Jim's "lldb-clean" root directory in the path. The
interfaces are now in a folder called "interfaces" withing the Xcode API
subfolder.

llvm-svn: 140451
2011-09-24 05:04:40 +00:00
Jim Ingham 810bf85e8a Add GetAddress to SBBreakpointLocation, and put the .i files in the API section of the Xcode project.
llvm-svn: 140440
2011-09-24 01:04:57 +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
Johnny Chen f04ee930a0 Add initial implementation of watchpoint commands for list, enable, disable, and delete.
Test cases to be added later.

llvm-svn: 140322
2011-09-22 18:04:58 +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
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
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
Sean Callanan 3bfdaa2a47 This patch modifies the expression parser to allow it
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.

This modification touches the following files:

lldb-private-enumerations.h
  Introduce a new enum specifying the policy for
  processing an expression.  Some expressions should
  always be JITted, for example if they are functions
  that will be used over and over again.  Some
  expressions should always be interpreted, for
  example if the target is unsafe to run.  For most,
  it is acceptable to JIT them, but interpretation
  is preferable when possible.

Target.[h,cpp]
  Have EvaluateExpression now accept the new enum.

ClangExpressionDeclMap.[cpp,h]
  Add support for the IR interpreter and also make
  the ClangExpressionDeclMap more robust in the 
  absence of a process.

ClangFunction.[cpp,h]
  Add support for the new enum.

IRInterpreter.[cpp,h]
  New implementation.

ClangUserExpression.[cpp,h]
  Add support for the new enum, and for running 
  expressions in the absence of a process.

ClangExpression.h
  Remove references to the old DWARF-based method
  of evaluating expressions, because it has been
  superseded for now.

ClangUtilityFunction.[cpp,h]
  Add support for the new enum.

ClangExpressionParser.[cpp,h]
  Add support for the new enum, remove references
  to DWARF, and add support for checking whether
  the expression could be evaluated statically.

IRForTarget.[h,cpp]
  Add support for the new enum, and add utility
  functions to support the interpreter.

IRToDWARF.cpp
  Removed

CommandObjectExpression.cpp
  Remove references to the obsolete -i option.

Process.cpp 
  Modify calls to ClangUserExpression::Evaluate
  to pass the correct enum (for dlopen/dlclose)

SBValue.cpp
  Add support for the new enum.

SBFrame.cpp
  Add support for he new enum.

BreakpointOptions.cpp
  Add support for the new enum.

llvm-svn: 139772
2011-09-15 02:13:07 +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
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 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
Johnny Chen 1d6bad0b47 Add a data type WatchpointLocationList to the repository. A Target contains an instance of watchpoint location list.
Also add a typefed for WatchpointLocationSP to lldb-forward-rtti.h.

llvm-svn: 139166
2011-09-06 20:05:25 +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 f9eec20bd3 Added support for accessing and loading our new .debug_names and .debug_types
DWARF accelerator table sections to the DWARF parser. These sections are similar
to the .debug_pubnames and .debug_pubtypes, but they are designed to be hash tables
that are saved to disc in a way that the sections can just be loaded into memory
and used without any work on the debugger side. The .debug_pubnames and .debug_pubtypes
sections are not ordered, contain a copy of the name in the section itself which
makes these sections quite large, they only include publicly exported names (so no
static functions, no types defined inside functions), many compilers put different
information in them making them very unreliable so most debugger ignore these sections
and parse the DWARF on their own. The tables must also be parsed and sorted in order 
to be used effectively. The new sections can be quickly loaded and very efficiently be used 
to do name to DIE lookups with very little up front work. The format of these new
sections will be changing while we work out the bugs, but we hope to have really 
fast name to DIE lookups soon.

llvm-svn: 138979
2011-09-01 23:16:13 +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
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
Greg Clayton 944b828abb Finishing the renaming from "MacOSX-Kernel" to "Darwin-Kernel".
llvm-svn: 138283
2011-08-22 22:30:57 +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