Commit Graph

499 Commits

Author SHA1 Message Date
Greg Clayton b6e8cf9663 Default "frame variable" to not show types before values by default. You now enable type display with --show-types or -t (instead of disabling it with --no-types or -t).
llvm-svn: 116418
2010-10-13 18:56:36 +00:00
Greg Clayton 247399230d Fixed C++ class clang type creation and display by making sure we omit
artifical members (like the vtable pointer member that shows up in the DWARF).
We were adding this to each class which was making all member variables be off
by a pointer size.

Added a test case so we can track this with "test/forward".

Fixed the type name index in DWARF to include all the types after finding
some types were being omitted due to the DW_AT_specification having the
DW_AT_declaration attribute which was being read into the real type instances
when there were forward declarations in the DWARF, causing the type to be
omitted. We now check to make sure any DW_AT_declaration values are only
respected when parsing types if the attribute is from the current DIE.

After fixing the missing types, we ran into some issues with the expression
parser finding duplicate entries for __va_list_tag since they are built in
types and would result in a "duplicate __va_list_tag definition" error. We
are now just ignoring this name during lookup, but we will need to see if
we can get the name lookup function to not get called in these cases.

Fixed an issue that would cause an assertion where DW_TAG_subroutine_types
that had no children, would not properly make a clang function type of:
"void (*) (void)".

llvm-svn: 116392
2010-10-13 03:15:28 +00:00
Caroline Tice 4239eadeee Comment out code that was preventing commands that take raw input strings
from being alias-able.

llvm-svn: 116357
2010-10-12 22:46:01 +00:00
Caroline Tice 4b6fbf370a Replace contains_string with 'strcasestr' from libc.
llvm-svn: 116351
2010-10-12 22:16:53 +00:00
Caroline Tice 4ab31c98e6 Fix some memory leaks.
Add call to lldb.SBDebugger.Initialize() to lldb.py, so it automatically gets called when
the lldb Python module gets loaded.

llvm-svn: 116345
2010-10-12 21:57:09 +00:00
Greg Clayton f220088295 Regular expression commands now print the command that results from expanding the regular expression command.
llvm-svn: 116320
2010-10-12 18:04:53 +00:00
Caroline Tice 636d6ed0c1 Fix bug where alias command options were being duplicated as command arguments as well.
llvm-svn: 116316
2010-10-12 17:45:19 +00:00
Greg Clayton 897f96a5d3 Fixed the dispatch queue name retrieval for threads by looking in an extra
shlib.

llvm-svn: 116315
2010-10-12 17:33:06 +00:00
Greg Clayton e02b850483 Modified the "breakpoint set --name NAME" to be the auto breakpoint set
function. It will inspect NAME and do the following:
- if the name contains '(' or starts with "-[" or "+[" then a full name search
  will happen to match full function names with args (C++ demangled names) or
  full objective C method prototypes.
- if the name contains "::" and no '(', then it is assumed to be a qualified
  function name that is in a namespace or class. For "foo::bar::baz" we will
  search for any functions with the basename or method name of "baz", then
  filter the results to only those that contain "foo::bar::baz". This allows
  setting breakpoint on C++ functions and methods without having to fully
  qualify all of the types that would appear in C++ mangled names.
- if the name contains ":" (not "::"), then NAME is assumed to be an ObjC
  selector.
_ otherwise, we assume just a plain function basename.

Now that "--name" is our "auto" mode, I introduced the new "--basename" option
("breakpoint set --basename NAME") to allow for function names that aren't 
methods or selectors, just basenames. This can also be used to ignore C++
namespaces and class hierarchies for class methods.

Fixed clang enumeration promotion types to be correct.

llvm-svn: 116293
2010-10-12 04:29:14 +00:00
Greg Clayton 450e3f3c77 Fixed the Objective C method prototypes to be correct (the selectors weren't
being chopped up correctly). The DWARF plug-in also keeps a map of the ObjC
class names to selectors for easy parsing of all class selectors when we parse
the class type.

llvm-svn: 116290
2010-10-12 02:24:53 +00:00
Jim Ingham 30f9b21bf4 Add a way to temporarily divert events from a broadcaster to a private listener.
llvm-svn: 116271
2010-10-11 23:53:14 +00:00
Greg Clayton aaf99e04ca Fixed an issue where objc types weren't ever getting fully resolved (beyond
forward declarations).

llvm-svn: 116181
2010-10-11 02:25:34 +00:00
Greg Clayton 6eee5aa067 Added a "--no-lldbinit" option (-n for short (which magically matches
what gdb uses)) so we can tell our "lldb" driver program to not automatically
parse any .lldbinit files. 

llvm-svn: 116179
2010-10-11 01:05:37 +00:00
Greg Clayton 46747022d2 Added the ability to get error strings back from failed
lldb_private::RegularExpression compiles and matches with:

    size_t
    RegularExpression::GetErrorAsCString (char *err_str, 
                                          size_t err_str_max_len) const;
    
Added the ability to search a variable list for variables whose names match
a regular expression:

    size_t
    VariableList::AppendVariablesIfUnique (const RegularExpression& regex, 
                                           VariableList &var_list, 
                                           size_t& total_matches);


Also added the ability to append a variable to a VariableList only if it is 
not already in the list:

    bool
    VariableList::AddVariableIfUnique (const lldb::VariableSP &var_sp);

Cleaned up the "frame variable" command:
- Removed the "-n NAME" option as this is the default way for the command to
  work.
- Enable uniqued regex searches on variable names by fixing the "--regex RE"
  command to work correctly. It will match all variables that match any
  regular expressions and only print each variable the first time it matches.
- Fixed the option type for the "--regex" command to by eArgTypeRegularExpression
  instead of eArgTypeCount

llvm-svn: 116178
2010-10-10 23:55:27 +00:00
Greg Clayton 864174e100 Added a new test case to test signals with.
Added frame relative frame selection to "frame select". You can now select
frames relative to the current frame (which defaults to zero if the current
frame hasn't yet been set for a thread):

The gdb "up" command can be done as:
(lldb) frame select -r 1
The gdb "down" command can be done as:
(lldb) frame select -r -1

Place the following in your ~/.lldbinit file for "up" and "down":

command alias up frame select -r 1
command alias down frame select -r -1

llvm-svn: 116176
2010-10-10 22:28:11 +00:00
Greg Clayton 222f5700c2 Plugged memory leak.
llvm-svn: 116175
2010-10-10 22:07:18 +00:00
Greg Clayton 6d7e77b9dc Added new options to memory read to allow saving memory to disk
as binary bytes or as an ASCII text dump. 
- The output file is specified with the  "--outfile FILE" option.
- The memory can be appended to an existing file using the "--append" option. 
- The memory will be written as an ASCII text dump by default, or as 
  binary with the "--binary" option. 

Added new options to memory write to allow writing all or part of
a file on disk to target memory:
- The input file is specified using the "--infile FILE" option
- The offset at which to start in the file defaults to zero, but
  can be overridden using the "--offset OFFSET" option. If the
  size is not specified, the remaining number of bytes in the file
  will be used as the default byte size.
- The number of bytes to write defaults to the entire file byte
  size, but can be changed with the "--size COUNT" option.
 

llvm-svn: 116172
2010-10-10 20:52:20 +00:00
Greg Clayton 237cd90620 Fixed process.gdb-remote to be able to properly propagate the signals and
obey the UnixSignals table that we have in the process.

llvm-svn: 116139
2010-10-09 01:40:57 +00:00
Greg Clayton b7c046248c Fixed a missing space when using the "apropos" command and you don't find any matches.
llvm-svn: 116133
2010-10-09 00:51:35 +00:00
Greg Clayton 74f6e9f523 Fixed a typo from my previous "Added support for LC_LOAD_UPWARD_DYLIB in mach-o files".
llvm-svn: 116132
2010-10-09 00:48:53 +00:00
Greg Clayton f9f78e3aae Added support for LC_LOAD_UPWARD_DYLIB in mach-o files.
llvm-svn: 116128
2010-10-09 00:16:01 +00:00
Johnny Chen e6acf35582 Emit a diagnostic message instead of crashing when an argument entry is missing.
llvm-svn: 116114
2010-10-08 22:01:52 +00:00
Johnny Chen 65045f2168 o TestStdCXXDisassembly.py:
Update the expected match string.

o lldbtest.py:

  Indicate when a command fails, even if there is nothing in the error stream.

o TestHelp.py:

  Add a regression test case for 'help image dump symtab'.

o CommandObjectHelp.cpp:

  Some of the logic branches with successful help command results were not tagged
  with a Success Status.  They are fixed now.  This is important for Python
  interaction.

llvm-svn: 116062
2010-10-08 17:21:27 +00:00
Johnny Chen e5e2b0c307 Fixed a crasher when doing 'help image dump symtab'. Supply the entry to the global arguments table.
llvm-svn: 116058
2010-10-08 16:36:25 +00:00
Greg Clayton 8087ca2160 Added mutex protection to the Symtab class.
Added a new SortOrder enumeration and hooked it up to the "image dump symtab"
command so we can dump symbol tables in the original order, sorted by address, 
or sorted by name.

llvm-svn: 116049
2010-10-08 04:20:14 +00:00
Sean Callanan 6b1b95376f Added extra logging, and made sure that the argument
struct for expressions is deallocated when the
ClangExpressionDeclMap is taken down.

llvm-svn: 116028
2010-10-08 01:58:41 +00:00
Greg Clayton 8941142af8 Hooked up ability to look up data symbols so they show up in disassembly
if the address comes from a data section. 

Fixed an issue that could occur when looking up a symbol that has a zero
byte size where no match would be returned even if there was an exact symbol
match.

Cleaned up the section dump output and added the section type into the output.

llvm-svn: 116017
2010-10-08 00:21:05 +00:00
Sean Callanan 5c67a628b0 Fixed a launching issue.
llvm-svn: 115999
2010-10-07 22:51:14 +00:00
Greg Clayton 68f4b4f2a2 Make sure to lock down the sequence mutex and select the thread we want when read or write all registers.
llvm-svn: 115992
2010-10-07 22:06:19 +00:00
Sean Callanan 4451136102 Changed the timeout for expressions from 10
milliseconds to 10 seconds, which was the
original intent.

llvm-svn: 115942
2010-10-07 18:17:31 +00:00
Greg Clayton c6ed542c90 More SWIG cleanup. Moved the breakpoint callback function back to the
ScriptInterpreterPython class and made a simple callback function that
ScriptInterpreterPython::BreakpointCallbackFunction() now calls so we don't
include any internal API stuff into the cpp file that is generated by SWIG.

Fixed a few build warnings in debugserver.

llvm-svn: 115926
2010-10-07 17:14:24 +00:00
Greg Clayton 05faeb7135 Cleaned up the SWIG stuff so all includes happen as they should, no pulling
tricks to get types to resolve. I did this by correctly including the correct
files: stdint.h and all lldb-*.h files first before including the API files.
This allowed me to remove all of the hacks that were in the lldb.swig file
and it also allows all of the #defines in lldb-defines.h and enumerations
in lldb-enumerations.h to appear in the lldb.py module. This will make the
python script code a lot more readable.

Cleaned up the "process launch" command to not execute a "process continue"
command, it now just does what it should have with the internal API calls
instead of executing another command line command.

Made the lldb_private::Process set the state to launching and attaching if
WillLaunch/WillAttach return no error respectively.

llvm-svn: 115902
2010-10-07 04:19:01 +00:00
Johnny Chen 0ed37c9615 o SBtarget.cpp/.h:
Temporarily commenting out the deprecated LaunchProcess() method.
  SWIG is not able to handle the overloaded functions.

o dotest.py/lldbtest.py:

  Add an '-w' option to insert some wait time between consecutive test cases.

o TestClassTypes.py:

  Make the breakpoint_creation_by_filespec_python() test method more robust and
  more descriptive by printing out a more insightful assert message.

o lldb.swig: Coaches swig to treat StateType as an int type, instead of a C++ class.

llvm-svn: 115899
2010-10-07 02:04:14 +00:00
Greg Clayton 524e60b4e4 Expose the error contained within an SBValue.
Move anything that creates a new process into SBTarget. Marked some functions
as deprecated. I will remove them after our new API changes make it through
a build cycle.

llvm-svn: 115854
2010-10-06 22:10:17 +00:00
Greg Clayton b4fb2a991c Leaving in deprecated functions until we can get a clean build with the new APIs in place before removing the deprecated functions.
llvm-svn: 115815
2010-10-06 18:44:26 +00:00
Greg Clayton 5d5028b54e Added the first of hopefully many python example scripts that show how to
use the python API that is exposed through SWIG to do some cool stuff.

Also fixed synchronous debugging so that all process control APIs exposed
through the python API will now wait for the process to stop if you set
the async mode to false (see disasm.py).

llvm-svn: 115738
2010-10-06 03:53:16 +00:00
Greg Clayton 1d27316606 Added the ability to get the disassembly instructions from the function and
symbol.

llvm-svn: 115734
2010-10-06 03:09:58 +00:00
Greg Clayton 32c4085ba2 Restored the ability to set the format for expressions after changing the expression results over to ValueObjectSP objects.
llvm-svn: 115733
2010-10-06 03:09:11 +00:00
Greg Clayton f4abd0db15 Fixed an issue with the mach-o file parser when parsing indirect symbol stubs
where the symbol index was set to INDIRECT_SYMBOL_ABS and was causing an
assertion to fire when we loaded older Mac OS X binaries.

llvm-svn: 115729
2010-10-06 01:26:32 +00:00
Sean Callanan 2ab40fecf6 Updated the expression parser to ignore non-external
functions it finds in libraries unless it cannot find
an external function with the desired name.

llvm-svn: 115721
2010-10-06 00:10:07 +00:00
Sean Callanan 85a0a83a26 Added handling for external variables in function
arguments to the expression parser.  This means that
structs can be returned from the "expr" command.

llvm-svn: 115698
2010-10-05 22:26:43 +00:00
Sean Callanan f4b9bd3e74 Added support for (de)materializing values in registers,
so that expressions can use them.

llvm-svn: 115658
2010-10-05 20:18:48 +00:00
Greg Clayton b71f384455 Added the notion that a value object can be constant by adding:
bool ValueObject::GetIsConstant() const;
    void ValueObject::SetIsConstant();

This will stop anything from being re-evaluated within the value object so
that constant result value objects can maintain their frozen values without
anything being updated or changed within the value object.

Made it so the ValueObjectConstResult can be constructed with an 
lldb_private::Error object to allow for expression results to have errors.

Since ValueObject objects contain error objects, I changed the expression
evaluation in ClangUserExpression from 

    static Error
    ClangUserExpression::Evaluate (ExecutionContext &exe_ctx, 
                                  const char *expr_cstr, 
                                  lldb::ValueObjectSP &result_valobj_sp);

to:

    static lldb::ValueObjectSP
    Evaluate (ExecutionContext &exe_ctx, const char *expr_cstr);
    
Even though expression parsing is borked right now (pending fixes coming from
Sean Callanan), I filled in the implementation for:
    
    SBValue SBFrame::EvaluateExpression (const char *expr);
    
Modified all expression code to deal with the above changes.

llvm-svn: 115589
2010-10-05 03:13:51 +00:00
Greg Clayton 0184f01936 Moved expression evaluation from CommandObjectExpression into
ClangUserExpression::Evaluate () as a public static function so anyone can
evaluate an expression.

llvm-svn: 115581
2010-10-05 00:31:29 +00:00
Greg Clayton 1d3afba3a3 Added a new ValueObject type that will be used to freeze dry expression
results. The clang opaque type for the expression result will be added to the
Target's ASTContext, and the bytes will be stored in a DataBuffer inside
the new object. The class is named: ValueObjectConstResult

Now after an expression is evaluated, we can get a ValueObjectSP back that
contains a ValueObjectConstResult object.

Relocated the value object dumping code into a static function within
the ValueObject class instead of being in the CommandObjectFrame.cpp file
which is what contained the code to dump variables ("frame variables").

llvm-svn: 115578
2010-10-05 00:00:42 +00:00
Jim Ingham 3bcdb29cab Add an "auto-confirm" setting to the debugger so you can turn off the confirmations if you want to.
llvm-svn: 115572
2010-10-04 22:44:14 +00:00
Caroline Tice 405fe67f14 Modify existing commands with arguments to use the new argument mechanism
(for standardized argument names, argument help, etc.)

llvm-svn: 115570
2010-10-04 22:28:36 +00:00
Chris Lattner 69d23282b4 Use the LLVM Macho.h header instead of relying on the system one,
patch by Arvid Picciani!

llvm-svn: 115563
2010-10-04 21:24:01 +00:00
Jim Ingham 97a6dc7e16 Add a "Confirm" function to the CommandInterpreter so you can confirm potentially dangerous operations in a generic way.
llvm-svn: 115546
2010-10-04 19:49:29 +00:00
Greg Clayton 3b06557e4f Added GetSymbol to the frame.
llvm-svn: 115535
2010-10-04 18:37:52 +00:00