Commit Graph

2342 Commits

Author SHA1 Message Date
Greg Clayton 2289fa4820 Added the ability to set the Platform path for a module through the SBModule
interface.

Added a quick way to set the platform though the SBDebugger interface. I will
actually an a SBPlatform support soon, but for now this will do.

ConnectionFileDescriptor can be passed a url formatted as: "fd://<fd>" where
<fd> is a file descriptor in the current process. This is handy if you have
services, deamons, or other tools that can spawn processes and give you a
file handle.

llvm-svn: 130565
2011-04-30 01:09:13 +00:00
Greg Clayton e5b3498eef Added the start of the CFI row production using the
emulate instruction classes.

llvm-svn: 130556
2011-04-29 22:50:31 +00:00
Johnny Chen f1c95f8bcb Update comments.
llvm-svn: 130533
2011-04-29 19:22:24 +00:00
Johnny Chen 31e4be06c4 Fix a bug introduced in my previous checkin, where the state was not properly
restored after parsing "SBTarget".  Indentation matters in Python. :-)

llvm-svn: 130532
2011-04-29 19:19:13 +00:00
Johnny Chen 0f023fa4af Add the Python rich comparison methods for SBBreakpoint, where GetID() returns
the breakpoint ID and provides the semantics needed for '==' and '!='.  And
modify LLDBIteratorTestCase.lldb_iter_2() to use '==' between two SBBreakpoint's.

llvm-svn: 130531
2011-04-29 19:03:02 +00:00
Johnny Chen 51cc833af7 Fix a typo.
llvm-svn: 130461
2011-04-28 23:53:16 +00:00
Johnny Chen 6cd4d1d85a Modified to take advantage of the iteration protocol for our lldb container objects.
llvm-svn: 130457
2011-04-28 23:34:58 +00:00
Johnny Chen e25799b99b Modified to take advantage of the iteration protocol for our lldb container objects.
llvm-svn: 130456
2011-04-28 23:26:17 +00:00
Johnny Chen e69c748328 Modify the test suite and lldbutil.py to utilize the Python iteration pattern now that
the lldb iteration protocol has been added to lldb.py module.

llvm-svn: 130452
2011-04-28 22:57:01 +00:00
Johnny Chen fbc0d27144 Move the iteration protocol of lldb objects to the auto-generated lldb Python module.
This is so that the objects which support the iteration protocol are immediately obvious
from looking at the lldb.py file.

SBTarget supports two types of iterations: module and breakpoint.  For an SBTarget instance,
you will need to issue either:

    for m in target.module_iter()

or

    for b in target.breakpoint_iter()

For other single iteration protocol objects, just use, for example:

    for thread in process:
        ID = thread.GetThreadID()
        for frame in thread:
            frame.Disassemble()
            ....

llvm-svn: 130442
2011-04-28 21:31:18 +00:00
Greg Clayton 68ebae61d1 Added the ability to specify dumping options (show types, show location,
depth control, pointer depth, and more) when dumping memory and viewing as
a type.

llvm-svn: 130436
2011-04-28 20:55:26 +00:00
Greg Clayton 84c39663a9 Added a new OptionValue subclass for lldb::Format: OptionValueFormat. Added
new OptionGroup subclasses for:
- output file for use with options: 
        long opts: --outfile <path> --append--output
        short opts: -o <path> -A
        
- format for use with options:
        long opts: --format <format>

- variable object display controls for depth, pointer depth, wether to show
  types, show summary, show location, flat output, use objc "po" style summary.
  
Modified ValueObjectMemory to be able to be created either with a TypeSP or
a ClangASTType.

Switched "memory read" over to use OptionGroup subclasses: one for the outfile
options, one for the command specific options, and one for the format.

llvm-svn: 130334
2011-04-27 22:04:39 +00:00
Johnny Chen b2e1a5c998 Add a utility function smart_iter() which has knowledge of the getsize and the getelem
method names of all the lldb container objects and returns an iterator object when
passed an eligible lldb container object.

Example:

    from lldb_util import smart_iter
    for thread in smart_iter(process):
        ID = thread.GetThreadID()
        if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
            stopped_due_to_breakpoint = True
        for frame in smart_iter(thread):
            self.assertTrue(frame.GetThread().GetThreadID() == ID)
        ...

Add a test case for lldb.smart_iter().

llvm-svn: 130332
2011-04-27 21:44:09 +00:00
Johnny Chen f6c61a34bf Use new string formatting operations in assert messages to simplify things.
llvm-svn: 130325
2011-04-27 19:52:41 +00:00
Johnny Chen 3c7a72c5ad Add another test case for lldb_iter(), this time using SBTarget to get at its SBBreakpoint containees.
llvm-svn: 130323
2011-04-27 19:29:39 +00:00
Jim Ingham d5c06a68b5 Removing Greg's working directory & startup arguments from the shared lldb-tool scheme.
llvm-svn: 130319
2011-04-27 18:49:17 +00:00
Johnny Chen de90f1dd93 Change the rest of lldbutil.py's function names to all lower case formats to be consistent.
And modify the test cases accordingly.

llvm-svn: 130314
2011-04-27 17:43:07 +00:00
Johnny Chen c5f121e3c0 Add a test case for lldbutil.lldb_iter() which returns an iterator object
for lldb objects which can contain other lldb objects.  Examples are:
SBTarget contains SBModule, SBModule contains SBSymbols, SBProcess contains
SBThread, SBThread contains SBFrame, etc.

llvm-svn: 130258
2011-04-26 23:54:25 +00:00
Greg Clayton 79ea878bf9 Got the EmulateInstruction CFI code a lot closer to producing CFI data.
Switch the EmulateInstruction to use the standard RegisterInfo structure
that is defined in the lldb private types intead of passing the reg kind and
reg num everywhere. EmulateInstruction subclasses also need to provide
RegisterInfo structs given a reg kind and reg num. This eliminates the need
for the GetRegisterName() virtual function and allows more complete information
to be passed around in the read/write register callbacks. Subclasses should
always provide RegiterInfo structs with the generic register info filled in as
well as at least one kind of register number in the RegisterInfo.kinds[] array.

llvm-svn: 130256
2011-04-26 23:48:45 +00:00
Johnny Chen 0a8a54c117 Docstring.
llvm-svn: 130254
2011-04-26 23:10:51 +00:00
Johnny Chen 35ec67464f Docstring.
llvm-svn: 130253
2011-04-26 23:10:15 +00:00
Johnny Chen 6424b7d272 Update comment.
llvm-svn: 130252
2011-04-26 23:07:40 +00:00
Johnny Chen 4fdcebda1d Docstring changees.
llvm-svn: 130251
2011-04-26 22:53:38 +00:00
Johnny Chen 489b52572c Simplify the parsing of ARCH and Compiler specs.
llvm-svn: 130240
2011-04-26 20:45:00 +00:00
Johnny Chen a85bf380ba Modify EmulateInstructionARM::SetArchitecture() to treat "arm" and "thumb" as wild card architectures
for now, in order to fix the test failure for the 'arm_emulation' directory.
There might be a better way.

llvm-svn: 130227
2011-04-26 18:51:57 +00:00
Greg Clayton 2ed751bd47 Changed the emulate instruction function to take emulate options which
are defined as enumerations. Current bits include:

        eEmulateInstructionOptionAutoAdvancePC
        eEmulateInstructionOptionIgnoreConditions

Modified the EmulateInstruction class to have a few more pure virtuals that
can help clients understand how many instructions the emulator can handle:

        virtual bool
        SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;


Where instruction types are defined as:

//------------------------------------------------------------------
/// Instruction types
//------------------------------------------------------------------    
typedef enum InstructionType
{
    eInstructionTypeAny,                // Support for any instructions at all (at least one)
    eInstructionTypePrologueEpilogue,   // All prologue and epilogue instructons that push and pop register values and modify sp/fp
    eInstructionTypePCModifying,        // Any instruction that modifies the program counter/instruction pointer
    eInstructionTypeAll                 // All instructions of any kind

}  InstructionType;


This allows use to tell what an emulator can do and also allows us to request
these abilities when we are finding the plug-in interface.

Added the ability for an EmulateInstruction class to get the register names
for any registers that are part of the emulation. This helps with being able
to dump and log effectively.

The UnwindAssembly class now stores the architecture it was created with in
case it is needed later in the unwinding process.

Added a function that can tell us DWARF register names for ARM that goes
along with the source/Utility/ARM_DWARF_Registers.h file: 

        source/Utility/ARM_DWARF_Registers.c
        
Took some of plug-ins out of the lldb_private namespace.

llvm-svn: 130189
2011-04-26 04:39:08 +00:00
Johnny Chen d0fef81e38 For lldbutil.py, Change a bunch of function names to all lower case formats to be consistent.
And modify the test cases accordingly.

llvm-svn: 130174
2011-04-25 23:38:13 +00:00
Caroline Tice c2bbb49aff Add 'lldb_private' namespace where necessary to prevent ambiguity and
resulting infinite loops.

llvm-svn: 130159
2011-04-25 22:05:51 +00:00
Johnny Chen d369908dac Move two functions around.
llvm-svn: 130158
2011-04-25 22:04:05 +00:00
Greg Clayton 7be2542fc9 Renamed UnwindAssemblyProfiler to UnwindAssembly along with its source files.
llvm-svn: 130156
2011-04-25 21:14:26 +00:00
Greg Clayton 078daac55d Even more renaming.
llvm-svn: 130155
2011-04-25 21:07:40 +00:00
Greg Clayton ffc922e389 More moving things around for the unwind plan and assembly unwind plug-ins.
llvm-svn: 130154
2011-04-25 21:05:07 +00:00
Johnny Chen fc87e2dd5c Make SBBreakpointLocation::GetDescription() API to be consistent with SBTarget,
i.e., with 'SBStream &description' first, followed by 'DescriptionLevel level'.

Modify lldbutil.py so that get_description() for a target or breakpoint location
can just take the lldb object itself without specifying an option to mean option
lldb.eDescriptionLevelBrief.  Modify TestTargetAPI.py to exercise this logic path.

llvm-svn: 130147
2011-04-25 20:23:05 +00:00
Greg Clayton dc5eb693bd Put plug-ins into the correct directories as they were incorrectly located
in a Utility directory.

llvm-svn: 130135
2011-04-25 18:36:36 +00:00
Johnny Chen 6b2a27c777 Fix test failure for '-A i386'.
llvm-svn: 130134
2011-04-25 18:20:52 +00:00
Johnny Chen 2b14d9b3f6 Update startstr argument of self.expect() to "a.out`sum(int, int)" to respond to recent change.
llvm-svn: 130133
2011-04-25 17:40:47 +00:00
Greg Clayton 7e14f91dbd Fixed the SymbolContext::DumpStopContext() to correctly indent and dump
inline contexts when the deepest most block is not inlined.

Added source path remappings to the lldb_private::Target class that allow it
to remap paths found in debug info so we can find source files that are elsewhere
on the current system.

Fixed disassembly by function name to disassemble inline functions that are
inside other functions much better and to show enough context before the
disassembly output so you can tell where things came from.

Added the ability to get more than one address range from a SymbolContext 
class for the case where a block or function has discontiguous address ranges.

llvm-svn: 130044
2011-04-23 02:04:55 +00:00
Johnny Chen 9ae982053f Convert the rest of the test suite to use the lldbutil.get_description() utility function.
llvm-svn: 130041
2011-04-23 00:34:56 +00:00
Johnny Chen 90256cdaba Add a simple utility function get_description(lldb_obj, option=None) to lldbutil.py
and use it from TestTargetAPI.py.

llvm-svn: 130038
2011-04-23 00:13:34 +00:00
Jim Ingham 58b59f9522 Fix up how the ValueObjects manage their life cycle so that you can hand out a shared
pointer to a ValueObject or any of its dependent ValueObjects, and the whole cluster will
stay around as long as that shared pointer stays around.

llvm-svn: 130035
2011-04-22 23:53:53 +00:00
Johnny Chen 787f71f269 Add test cases for the SBTarget.GetDescription() API which takes an extra lldb::DescriptionLevel enum.
llvm-svn: 130029
2011-04-22 23:20:17 +00:00
Johnny Chen ea0d135d37 We are only interested in logging the child's output to sys.stdout.
llvm-svn: 130017
2011-04-22 21:56:22 +00:00
Johnny Chen 35c3ae9639 Fix comment.
llvm-svn: 130016
2011-04-22 21:50:08 +00:00
Johnny Chen ea76c4f229 Make test_connect_remote() more robust by waiting on the server ready message
before issuing the 'process connect ...' command.

test_comand_regex(): assign the spawned child to self.child so it gets automatically
shutdown during TestBase.tearDown(self).

llvm-svn: 130015
2011-04-22 21:47:07 +00:00
Greg Clayton 8a51be9e1b Reroute the blog link to the LLVM blog site.
llvm-svn: 130014
2011-04-22 21:03:40 +00:00
Greg Clayton a348259b3d Erase from a string instead of using substr when you don't really need to.
llvm-svn: 130013
2011-04-22 20:58:45 +00:00
Johnny Chen a2abf701e2 Fix a typo.
llvm-svn: 130011
2011-04-22 20:40:26 +00:00
Caroline Tice 6a4f755a2b Remove old emulation test data files.
llvm-svn: 129993
2011-04-22 16:29:23 +00:00
Caroline Tice 526f9ad25e Modify to use the new test files.
llvm-svn: 129992
2011-04-22 16:05:13 +00:00
Caroline Tice 8401cdbd0e Reformat the emulation test data files.
llvm-svn: 129991
2011-04-22 16:03:05 +00:00