Commit Graph

4313 Commits

Author SHA1 Message Date
Sean Callanan d2b465f17a Brought LLVM/Clang up to top of tree. The only
change (besides logging) is that now string
literals in the IR are ConstantDataArrays instead
of ConstantArrays.

llvm-svn: 150142
2012-02-09 03:22:41 +00:00
Sean Callanan 12b0dabd31 Removed another debug message. Sigh...
llvm-svn: 150134
2012-02-09 02:04:23 +00:00
Johnny Chen 57816730f0 Add safe guard for when the 'expect' program cannot be located and skip the test.
llvm-svn: 150133
2012-02-09 02:01:59 +00:00
Jim Ingham 6a4617bb01 Some Breakpoint:: methods crept down be log the Breakpoint::BreakpointEventData methods.
llvm-svn: 150131
2012-02-09 01:49:26 +00:00
Johnny Chen 177df6f35c Set the terminal type to 'xterm' before doing 'stty -a'.
llvm-svn: 150127
2012-02-09 01:16:04 +00:00
Sean Callanan acda6789df Remembered to NULL out the symbol, which was
causing testsuite crashes.

llvm-svn: 150125
2012-02-09 00:54:55 +00:00
Johnny Chen 4dcad1437c Make the expect_prompt more strict.
llvm-svn: 150124
2012-02-09 00:51:41 +00:00
Johnny Chen 7cc99dc40f Add a case to test that 'stty -a' displays the same output before and after running the lldb command.
llvm-svn: 150119
2012-02-09 00:27:01 +00:00
Johnny Chen 2ffa754a6f After discussions with Jim and Greg, modify the 'watchpoint set' command to become a mutiword command
with subcommand 'expression' and 'variable'.  The first subcommand is for supplying an expression to
be evaluated into an address to watch for, while the second is for watching a variable.

'watchpoint set expression' is a raw command, which means that you need to use the "--" option terminator
to end the '-w' or '-x' option processing and to start typing your expression.

Also update several test cases to comply and add a couple of test cases into TestCompletion.py,
in particular, test that 'watchpoint set ex' completes to 'watchpoint set expression ' and that
'watchpoint set var' completes to 'watchpoint set variable '.

llvm-svn: 150109
2012-02-08 22:37:48 +00:00
Sean Callanan 80ef1245cc Added support to the expression parser for reading
variables that are only available in symbols.

llvm-svn: 150103
2012-02-08 21:55:14 +00:00
Enrico Granata 5a1bff08dd fixing comment to reflect that currentversion of OSX works with our STL formatters
llvm-svn: 150085
2012-02-08 19:57:18 +00:00
Sean Callanan aa719af082 In the absence of a valid process, the expression
parser now at least tries to generate IR for the
target.

llvm-svn: 150079
2012-02-08 18:43:35 +00:00
Jason Molenda c56a4ea178 Version bump to 113.
llvm-svn: 150063
2012-02-08 07:31:16 +00:00
Jim Ingham e6bc6cb96f Send Breakpoint Changed events for all the relevant changes to breakpoints.
Also, provide and use accessors for the thread options on breakpoints so we
can control sending the appropriate events.

llvm-svn: 150057
2012-02-08 05:23:15 +00:00
Sean Callanan c03bdd9c80 Fixed ClangExpressionDeclMap to use the debug
information about the current frame rather than
the debug information about "this" and "self"
when determining the types of those pointers.
This allows expressions to work in frames that
don't have valid "this" and "self" pointers,
working around poor debug information.

llvm-svn: 150051
2012-02-08 03:45:08 +00:00
Johnny Chen 3434b19d63 Clarify the 'frame variable' help message regarding the watchpoint functionality.
llvm-svn: 150039
2012-02-08 01:50:38 +00:00
Johnny Chen 97cdf36171 Update comment.
llvm-svn: 150036
2012-02-08 01:35:38 +00:00
Sean Callanan 94a9a39ec4 The IRInterpreter's constant evaluator wasn't
sufficiently general - it could only handle
literals and operations that didn't change the
data.  Now the constant evaluator passes APInt
values around, and can handle GetElementPtr
constants.

llvm-svn: 150034
2012-02-08 01:27:49 +00:00
Johnny Chen 34ddc8db22 Refine the 'watchpoint set' command to now require either the '-v' option (for watching of a variable) or
the '-e' option (for watching of an address) to be present.

Update some existing test cases with the required option and add some more test cases.

Since the '-v' option takes <variable-name> and the '-e' option takes <expr> as the command arg,
the existing infrastructure for generating the option usage can produce confusing help message,
like:

  watchpoint set -e [-w <watch-type>] [-x <byte-size>] <variable-name | expr>
  watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name | expr>

The solution adopted is to provide an extra member field to the struct CommandArgumentData called
(uint32_t)arg_opt_set_association, whose purpose is to link this particular argument data with some
option set(s).  Also modify the signature of CommandObject::GetFormattedCommandArguments() to:

  GetFormattedCommandArguments (Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL)

it now takes an additional opt_set_mask which can be used to generate a filtered formatted command
args for help message.

Options::GenerateOptionUsage() impl is modified to call the GetFormattedCommandArguments() appropriately.
So that the help message now looks like:

  watchpoint set -e [-w <watch-type>] [-x <byte-size>] <expr>
  watchpoint set -v [-w <watch-type>] [-x <byte-size>] <variable-name>

rdar://problem/10703256

llvm-svn: 150032
2012-02-08 01:13:31 +00:00
Sean Callanan 904febc89c Added a .gitignore so that "git status" isn't
quite as busy.

llvm-svn: 150005
2012-02-07 21:53:52 +00:00
Sean Callanan 8e8072d195 Made SymbolFileDWARF be less strict when looking
for types that can be uniqued to the given type.
This is especially helpful when types are missing
file and line information.

llvm-svn: 150004
2012-02-07 21:13:38 +00:00
Johnny Chen fe3bdad393 Add help string for 'frame variable' to link to 'watchpoint set' which allows for using an expression to specify the address to watch for.
rdar://problem/10703290

llvm-svn: 149917
2012-02-06 22:17:23 +00:00
Sean Callanan 7e2863b416 I left some stray debugging messages in the source
code.  Removing these.

llvm-svn: 149903
2012-02-06 21:28:03 +00:00
Johnny Chen a2791f8aeb Special build dictionary needs the same dictionary when specifying the after-the-test cleanup.
llvm-svn: 149900
2012-02-06 21:11:17 +00:00
Johnny Chen 3397e7cd22 Fix a typo in specifying the error path when launching the inferior.
llvm-svn: 149899
2012-02-06 21:07:21 +00:00
Johnny Chen a27a16c04d Print out the frame only if self.TraceOn() is True.
llvm-svn: 149893
2012-02-06 19:36:29 +00:00
Johnny Chen 2eb6c3d246 Add regular C++ inheritance in addition to the virtual inheritance to TestCppValueCast.py.
Plus mark the virtual inheritance test cases as expected failures.

llvm-svn: 149891
2012-02-06 19:14:44 +00:00
Greg Clayton 3c2e3ae490 Almost have templatized functions working (templatized classes are already
working, but not functions). I need to check on a few things to make sure 
I am registering everything correctly in the right order and in the right
contexts.

llvm-svn: 149858
2012-02-06 06:42:51 +00:00
Greg Clayton 5569e64ea7 Removed all of the "#ifndef SWIG" from the SB header files since we are using
interface (.i) files for each class.

Changed the FindFunction class from:

uint32_t
SBTarget::FindFunctions (const char *name, 
                         uint32_t name_type_mask, 
                         bool append, 
                         lldb::SBSymbolContextList& sc_list)

uint32_t
SBModule::FindFunctions (const char *name, 
                         uint32_t name_type_mask, 
                         bool append, 
                         lldb::SBSymbolContextList& sc_list)

To:

lldb::SBSymbolContextList
SBTarget::FindFunctions (const char *name, 
                         uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

lldb::SBSymbolContextList
SBModule::FindFunctions (const char *name,
                         uint32_t name_type_mask = lldb::eFunctionNameTypeAny);

This makes the API easier to use from python. Also added the ability to
append a SBSymbolContext or a SBSymbolContextList to a SBSymbolContextList.

Exposed properties for lldb.SBSymbolContextList in python:

lldb.SBSymbolContextList.modules => list() or all lldb.SBModule objects in the list
lldb.SBSymbolContextList.compile_units => list() or all lldb.SBCompileUnits objects in the list
lldb.SBSymbolContextList.functions => list() or all lldb.SBFunction objects in the list
lldb.SBSymbolContextList.blocks => list() or all lldb.SBBlock objects in the list
lldb.SBSymbolContextList.line_entries => list() or all lldb.SBLineEntry objects in the list
lldb.SBSymbolContextList.symbols => list() or all lldb.SBSymbol objects in the list

This allows a call to the SBTarget::FindFunctions(...) and SBModule::FindFunctions(...)
and then the result can be used to extract the desired information:

sc_list = lldb.target.FindFunctions("erase")

for function in sc_list.functions:
    print function
for symbol in sc_list.symbols:
    print symbol

Exposed properties for the lldb.SBSymbolContext objects in python:

lldb.SBSymbolContext.module => lldb.SBModule
lldb.SBSymbolContext.compile_unit => lldb.SBCompileUnit
lldb.SBSymbolContext.function => lldb.SBFunction
lldb.SBSymbolContext.block => lldb.SBBlock
lldb.SBSymbolContext.line_entry => lldb.SBLineEntry
lldb.SBSymbolContext.symbol => lldb.SBSymbol


Exposed properties for the lldb.SBBlock objects in python:

lldb.SBBlock.parent => lldb.SBBlock for the parent block that contains
lldb.SBBlock.sibling => lldb.SBBlock for the sibling block to the current block
lldb.SBBlock.first_child => lldb.SBBlock for the first child block to the current block
lldb.SBBlock.call_site => for inline functions, return a lldb.declaration object that gives the call site file, line and column
lldb.SBBlock.name => for inline functions this is the name of the inline function that this block represents
lldb.SBBlock.inlined_block => returns the inlined function block that contains this block (might return itself if the current block is an inlined block)
lldb.SBBlock.range[int] => access the address ranges for a block by index, a list() with start and end address is returned
lldb.SBBlock.ranges => an array or all address ranges for this block
lldb.SBBlock.num_ranges => the number of address ranges for this blcok

SBFunction objects can now get the SBType and the SBBlock that represents the
top scope of the function.

SBBlock objects can now get the variable list from the current block. The value
list returned allows varaibles to be viewed prior with no process if code
wants to check the variables in a function. There are two ways to get a variable
list from a SBBlock:

lldb::SBValueList
SBBlock::GetVariables (lldb::SBFrame& frame,
                       bool arguments,
                       bool locals,
                       bool statics,
                       lldb::DynamicValueType use_dynamic);

lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
                       bool arguments,
                       bool locals,
                       bool statics);

When a SBFrame is used, the values returned will be locked down to the frame
and the values will be evaluated in the context of that frame.

When a SBTarget is used, global an static variables can be viewed without a
running process.

llvm-svn: 149853
2012-02-06 01:44:54 +00:00
Greg Clayton 3b775bff47 Made a fix that would affect anything in the anonymous namespace when looking
for types and comparing decl context matches.

llvm-svn: 149812
2012-02-05 06:14:55 +00:00
Greg Clayton 80c26308cc Added some extra comments for the declaration context comparison function
in the DWARF plug-in.

llvm-svn: 149811
2012-02-05 06:12:47 +00:00
Greg Clayton c96605461c <rdar://problem/10560053>
Fixed "target modules list" (aliased to "image list") to output more information
by default. Modified the "target modules list" to have a few new options:

"--header" or "-h" => show the image header address
"--offset" or "-o" => show the image header address offset from the address in the file (the slide applied to the shared library)

Removed the "--symfile-basename" or "-S" option, and repurposed it to 
"--symfile-unique" "-S" which will show the symbol file if it differs from
the executable file.

ObjectFile's can now be loaded from memory for cases where we don't have the
files cached locally in an SDK or net mounted root. ObjectFileMachO can now
read mach files from memory.

Moved the section data reading code into the ObjectFile so that the object
file can get the section data from Process memory if the file is only in
memory.

lldb_private::Module can now load its object file in a target with a rigid 
slide (very common operation for most dynamic linkers) by using:

bool 
Module::SetLoadAddress (Target &target, lldb::addr_t offset, bool &changed)

lldb::SBModule() now has a new constructor in the public interface:

SBModule::SBModule (lldb::SBProcess &process, lldb::addr_t header_addr);

This will find an appropriate ObjectFile plug-in to load an image from memory
where the object file header is at "header_addr".

llvm-svn: 149804
2012-02-05 02:38:54 +00:00
Sean Callanan 5b26f27f46 I have brought LLDB up-to-date with top of tree
LLVM/Clang.  This brings in several fixes, including:

- Improvements in the Just-In-Time compiler's
  allocation of memory: the JIT now allocates
  memory in chunks of sections, improving its
  ability to generate relocations.  I have
  revamped the RecordingMemoryManager to reflect
  these changes, as well as to get the memory
  allocation and data copying out fo the
  ClangExpressionParser code.  Jim Grosbach wrote
  the updates to the JIT on the LLVM side.

- A new ExternalASTSource interface to allow LLDB to
  report accurate structure layout information to
  Clang.  Previously we could only report the sizes
  of fields, not their offsets.  This meant that if
  data structures included field alignment
  directives, we could not communicate the necessary
  alignment to Clang and accesses to the data would
  fail.  Now we can (and I have update the relevant
  test case).  Thanks to Doug Gregor for implementing
  the Clang side of this fix.

- The way Objective-C interfaces are completed by
  Clang has been made consistent with RecordDecls;
  with help from Doug Gregor and Greg Clayton I have
  ensured that this still works.

- I have eliminated all local LLVM and Clang patches,
  committing the ones that are still relevant to LLVM
  and Clang as needed.

I have tested the changes extensively locally, but
please let me know if they cause any trouble for you.

llvm-svn: 149775
2012-02-04 08:49:35 +00:00
Greg Clayton 819134a7c4 Allow a SBAddress to be created from a SBSection and an offset.
Changed the lldb.SBModule.section[<str>] property to return a single section.

Added a lldb.SBSection.addr property which returns an lldb.SBAddress object.

llvm-svn: 149755
2012-02-04 02:58:17 +00:00
Greg Clayton 81e871ed76 Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an
expression that can be used to recreate an python object and we were using
it to just return a human readable string.

Fixed a crasher when using the new implementation of SBValue::Cast(SBType).

Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
improvements to the API.

Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
correctly handle not having a target.

llvm-svn: 149743
2012-02-04 02:27:34 +00:00
Johnny Chen b428b69745 Add test cases for SBValue.Cast(SBType). The test logic needs more polishing.
llvm-svn: 149741
2012-02-04 02:07:33 +00:00
Johnny Chen 9dad8ae6c6 Fix typos.
llvm-svn: 149710
2012-02-03 20:50:56 +00:00
Johnny Chen 15f247ad8c Add test cases for APIs to get template arguments from an SBType.
llvm-svn: 149707
2012-02-03 20:43:00 +00:00
Enrico Granata 4cee9e5247 Fixing issues where synthetic children providers for STL containers std::list and std::map where not doing their job properly
llvm-svn: 149700
2012-02-03 18:11:52 +00:00
Greg Clayton 7edbdfc97c Expose more convenience functionality in the python classes.
lldb.SBValueList now exposes the len() method and also allows item access:

lldb.SBValueList[<int>] - where <int> is an integer index into the list, returns a single lldb.SBValue which might be empty if the index is out of range
lldb.SBValueList[<str>] - where <str> is the name to look for, returns a list() of lldb.SBValue objects with any matching values (the list might be empty if nothing matches)
lldb.SBValueList[<re>]  - where <re> is a compiles regular expression, returns a list of lldb.SBValue objects for containing any matches or a empty list if nothing matches

lldb.SBFrame now exposes:

lldb.SBFrame.variables => SBValueList of all variables that are in scope
lldb.SBFrame.vars => see lldb.SBFrame.variables
lldb.SBFrame.locals => SBValueList of all variables that are locals in the current frame
lldb.SBFrame.arguments => SBValueList of all variables that are arguments in the current frame
lldb.SBFrame.args => see lldb.SBFrame.arguments
lldb.SBFrame.statics => SBValueList of all static variables
lldb.SBFrame.registers => SBValueList of all registers for the current frame
lldb.SBFrame.regs => see lldb.SBFrame.registers

Combine any of the above properties with the new lldb.SBValueList functionality
and now you can do:

y = lldb.frame.vars['rect.origin.y']

or

vars = lldb.frame.vars
for i in range len(vars):
  print vars[i]

Also expose "lldb.SBFrame.var(<str>)" where <str> can be en expression path
for any variable or child within the variable. This makes it easier to get a
value from the current frame like "rect.origin.y". The resulting value is also
not a constant result as expressions will return, but a live value that will
continue to track the current value for the variable expression path.

lldb.SBValue now exposes:

lldb.SBValue.unsigned => unsigned integer for the value
lldb.SBValue.signed => a signed integer for the value

llvm-svn: 149684
2012-02-03 07:02:37 +00:00
Greg Clayton 9a142cf84d Fixed casting in the lldb::SBValue::Cast(SBType) function.
llvm-svn: 149673
2012-02-03 05:34:10 +00:00
Greg Clayton b62bb8cedc Cleaned up the documentation strings for many helper objects and added
lldb.SBModule.section and lldb.SBModule.sections property access.

llvm-svn: 149665
2012-02-03 03:22:53 +00:00
Enrico Granata 1d261d1c0c Adding support for an "equivalents map". This can be useful when compilers emit multiple, different names for the same actual type. In such scenarios, one of the type names can actually be found during a type lookup, while the others are just aliases. This can cause issues when trying to work with these aliased names and being unable to resolve them to an actual type (e.g. getting an SBType for the aliased name).
Currently, no code is using this feature, since we can hopefully rely on the new template support in SBType to get the same stuff done, but the support is there just in case it turns out to be useful for some future need.

llvm-svn: 149661
2012-02-03 01:41:25 +00:00
Greg Clayton 402230e633 Added support to SBType for getting template arguments from a SBType:
uint32_t
SBType::GetNumberOfTemplateArguments ();

lldb::SBType
SBType::GetTemplateArgumentType (uint32_t idx);

lldb::TemplateArgumentKind
SBType::GetTemplateArgumentKind (uint32_t idx);

Some lldb::TemplateArgumentKind values don't have a corresponding SBType
that will be returned from SBType::GetTemplateArgumentType(). This will
help our data formatters do their job by being able to find out the
type of template params and do smart things with those.

llvm-svn: 149658
2012-02-03 01:30:30 +00:00
Johnny Chen 60b4f13c11 Add a couple of simple completion test cases for 'target ' and 'target va'.
llvm-svn: 149656
2012-02-03 01:14:42 +00:00
Enrico Granata a6a60d0d87 Added a new --omit-names (-O, uppercase letter o) option to "type summary add".
When used in conjunction with --inline-children, this option will cause the names of the values to be omitted from the output. This can be beneficial in cases such as vFloat, where it will compact the representation from
([0]=1,[1]=2,[2]=3,[3]=4) to (1, 2, 3, 4).
Added a test case to check that the new option works correctly.
Also took some time to revisit SummaryFormat and related classes and tweak them for added readability and maintainability.
Finally, added a new class name to which the std::string summary should be applied.

llvm-svn: 149644
2012-02-02 23:34:52 +00:00
Johnny Chen 04ef9492fd Should have used the convenience function:
bool
lldb_private::StateIsStoppedState (StateType state, bool must_exist)

instead.

llvm-svn: 149637
2012-02-02 22:11:13 +00:00
Johnny Chen fd72fbef41 For processes which are not in one of the "launched and stopped" state, 'target variable' command
should use Target::ReadMemory() call to read from the file section offset address.
Also remove the @expectedFailure decorator..

'target variable' command fails if the target program has been run
rdar://problem/9763907

llvm-svn: 149629
2012-02-02 19:55:18 +00:00
Greg Clayton f571b89054 Fixed terminal settings not being properly restored when "quit" was run.
This affected bash users.

llvm-svn: 149623
2012-02-02 19:28:31 +00:00
Greg Clayton fb640c2d4c Kill our child process that we launch when we can't get the task_for_pid()
otherwise we will have a launched process stopped at the entry point and
it will get reparented when debugserver goes away and we won't be able to
kill the process later.

llvm-svn: 149622
2012-02-02 19:23:22 +00:00