2011-07-17 05:15:39 +08:00
|
|
|
//===-- SWIG Interface for SBTarget -----------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
namespace lldb {
|
|
|
|
|
2012-02-24 13:03:03 +08:00
|
|
|
class SBLaunchInfo
|
|
|
|
{
|
2012-02-25 04:59:25 +08:00
|
|
|
public:
|
|
|
|
SBLaunchInfo (const char **argv);
|
2012-02-24 13:03:03 +08:00
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetUserID();
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetGroupID();
|
|
|
|
|
|
|
|
bool
|
|
|
|
UserIDIsValid ();
|
|
|
|
|
|
|
|
bool
|
|
|
|
GroupIDIsValid ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetUserID (uint32_t uid);
|
|
|
|
|
|
|
|
void
|
|
|
|
SetGroupID (uint32_t gid);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetNumArguments ();
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetArgumentAtIndex (uint32_t idx);
|
|
|
|
|
|
|
|
void
|
|
|
|
SetArguments (const char **argv, bool append);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetNumEnvironmentEntries ();
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetEnvironmentEntryAtIndex (uint32_t idx);
|
|
|
|
|
|
|
|
void
|
|
|
|
SetEnvironmentEntries (const char **envp, bool append);
|
|
|
|
|
|
|
|
void
|
|
|
|
Clear ();
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetWorkingDirectory () const;
|
|
|
|
|
|
|
|
void
|
|
|
|
SetWorkingDirectory (const char *working_dir);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetLaunchFlags ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetLaunchFlags (uint32_t flags);
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetProcessPluginName ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetProcessPluginName (const char *plugin_name);
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetShell ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetShell (const char * path);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetResumeCount ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetResumeCount (uint32_t c);
|
|
|
|
|
|
|
|
bool
|
|
|
|
AddCloseFileAction (int fd);
|
|
|
|
|
|
|
|
bool
|
|
|
|
AddDuplicateFileAction (int fd, int dup_fd);
|
|
|
|
|
|
|
|
bool
|
|
|
|
AddOpenFileAction (int fd, const char *path, bool read, bool write);
|
|
|
|
|
|
|
|
bool
|
|
|
|
AddSuppressFileAction (int fd, bool read, bool write);
|
|
|
|
};
|
|
|
|
|
|
|
|
class SBAttachInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SBAttachInfo ();
|
|
|
|
|
|
|
|
SBAttachInfo (lldb::pid_t pid);
|
|
|
|
|
|
|
|
SBAttachInfo (const char *path, bool wait_for);
|
|
|
|
|
|
|
|
SBAttachInfo (const lldb::SBAttachInfo &rhs);
|
|
|
|
|
|
|
|
lldb::pid_t
|
|
|
|
GetProcessID ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetProcessID (lldb::pid_t pid);
|
|
|
|
|
|
|
|
void
|
|
|
|
SetExecutable (const char *path);
|
|
|
|
|
|
|
|
void
|
|
|
|
SetExecutable (lldb::SBFileSpec exe_file);
|
|
|
|
|
|
|
|
bool
|
|
|
|
GetWaitForLaunch ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetWaitForLaunch (bool b);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetResumeCount ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetResumeCount (uint32_t c);
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetProcessPluginName ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetProcessPluginName (const char *plugin_name);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetEffectiveUserID();
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetEffectiveGroupID();
|
|
|
|
|
|
|
|
bool
|
|
|
|
EffectiveUserIDIsValid ();
|
|
|
|
|
|
|
|
bool
|
|
|
|
EffectiveGroupIDIsValid ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetEffectiveUserID (uint32_t uid);
|
|
|
|
|
|
|
|
void
|
|
|
|
SetEffectiveGroupID (uint32_t gid);
|
|
|
|
|
|
|
|
lldb::pid_t
|
|
|
|
GetParentProcessID ();
|
|
|
|
|
|
|
|
void
|
|
|
|
SetParentProcessID (lldb::pid_t pid);
|
|
|
|
|
|
|
|
bool
|
|
|
|
ParentProcessIDIsValid();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
%feature("docstring",
|
|
|
|
"Represents the target program running under the debugger.
|
|
|
|
|
2011-10-14 08:42:25 +08:00
|
|
|
SBTarget supports module, breakpoint, and watchpoint iterations. For example,
|
2011-07-17 05:15:39 +08:00
|
|
|
|
|
|
|
for m in target.module_iter():
|
|
|
|
print m
|
|
|
|
|
|
|
|
produces:
|
|
|
|
|
|
|
|
(x86_64) /Volumes/data/lldb/svn/trunk/test/python_api/lldbutil/iter/a.out
|
|
|
|
(x86_64) /usr/lib/dyld
|
|
|
|
(x86_64) /usr/lib/libstdc++.6.dylib
|
|
|
|
(x86_64) /usr/lib/libSystem.B.dylib
|
|
|
|
(x86_64) /usr/lib/system/libmathCommon.A.dylib
|
|
|
|
(x86_64) /usr/lib/libSystem.B.dylib(__commpage)
|
|
|
|
|
|
|
|
and,
|
|
|
|
|
|
|
|
for b in target.breakpoint_iter():
|
|
|
|
print b
|
|
|
|
|
|
|
|
produces:
|
|
|
|
|
|
|
|
SBBreakpoint: id = 1, file ='main.cpp', line = 66, locations = 1
|
2011-09-27 09:19:20 +08:00
|
|
|
SBBreakpoint: id = 2, file ='main.cpp', line = 85, locations = 1
|
|
|
|
|
|
|
|
and,
|
|
|
|
|
2011-10-14 08:42:25 +08:00
|
|
|
for wp_loc in target.watchpoint_iter():
|
2011-09-27 09:19:20 +08:00
|
|
|
print wp_loc
|
|
|
|
|
|
|
|
produces:
|
|
|
|
|
2011-10-14 08:42:25 +08:00
|
|
|
Watchpoint 1: addr = 0x1034ca048 size = 4 state = enabled type = rw
|
2011-09-27 09:19:20 +08:00
|
|
|
declare @ '/Volumes/data/lldb/svn/trunk/test/python_api/watchpoint/main.c:12'
|
2011-10-14 08:42:25 +08:00
|
|
|
hw_index = 0 hit_count = 2 ignore_count = 0"
|
2011-07-19 04:13:38 +08:00
|
|
|
) SBTarget;
|
2011-07-17 05:15:39 +08:00
|
|
|
class SBTarget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Broadcaster bits.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
eBroadcastBitBreakpointChanged = (1 << 0),
|
|
|
|
eBroadcastBitModulesLoaded = (1 << 1),
|
|
|
|
eBroadcastBitModulesUnloaded = (1 << 2)
|
|
|
|
};
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Constructors
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
SBTarget ();
|
|
|
|
|
|
|
|
SBTarget (const lldb::SBTarget& rhs);
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Destructor
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
~SBTarget();
|
|
|
|
|
2012-02-16 14:50:00 +08:00
|
|
|
static const char *
|
|
|
|
GetBroadcasterClassName ();
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
bool
|
|
|
|
IsValid() const;
|
|
|
|
|
|
|
|
lldb::SBProcess
|
|
|
|
GetProcess ();
|
|
|
|
|
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Launch a new process.
|
|
|
|
///
|
|
|
|
/// Launch a new process by spawning a new process using the
|
|
|
|
/// target object's executable module's file as the file to launch.
|
|
|
|
/// Arguments are given in \a argv, and the environment variables
|
|
|
|
/// are in \a envp. Standard input and output files can be
|
|
|
|
/// optionally re-directed to \a stdin_path, \a stdout_path, and
|
|
|
|
/// \a stderr_path.
|
|
|
|
///
|
|
|
|
/// @param[in] listener
|
|
|
|
/// An optional listener that will receive all process events.
|
|
|
|
/// If \a listener is valid then \a listener will listen to all
|
|
|
|
/// process events. If not valid, then this target's debugger
|
|
|
|
/// (SBTarget::GetDebugger()) will listen to all process events.
|
|
|
|
///
|
|
|
|
/// @param[in] argv
|
|
|
|
/// The argument array.
|
|
|
|
///
|
|
|
|
/// @param[in] envp
|
|
|
|
/// The environment array.
|
|
|
|
///
|
|
|
|
/// @param[in] launch_flags
|
|
|
|
/// Flags to modify the launch (@see lldb::LaunchFlags)
|
|
|
|
///
|
|
|
|
/// @param[in] stdin_path
|
|
|
|
/// The path to use when re-directing the STDIN of the new
|
|
|
|
/// process. If all stdXX_path arguments are NULL, a pseudo
|
|
|
|
/// terminal will be used.
|
|
|
|
///
|
|
|
|
/// @param[in] stdout_path
|
|
|
|
/// The path to use when re-directing the STDOUT of the new
|
|
|
|
/// process. If all stdXX_path arguments are NULL, a pseudo
|
|
|
|
/// terminal will be used.
|
|
|
|
///
|
|
|
|
/// @param[in] stderr_path
|
|
|
|
/// The path to use when re-directing the STDERR of the new
|
|
|
|
/// process. If all stdXX_path arguments are NULL, a pseudo
|
|
|
|
/// terminal will be used.
|
|
|
|
///
|
|
|
|
/// @param[in] working_directory
|
|
|
|
/// The working directory to have the child process run in
|
|
|
|
///
|
|
|
|
/// @param[in] launch_flags
|
|
|
|
/// Some launch options specified by logical OR'ing
|
|
|
|
/// lldb::LaunchFlags enumeration values together.
|
|
|
|
///
|
|
|
|
/// @param[in] stop_at_endtry
|
|
|
|
/// If false do not stop the inferior at the entry point.
|
|
|
|
///
|
|
|
|
/// @param[out]
|
|
|
|
/// An error object. Contains the reason if there is some failure.
|
|
|
|
///
|
|
|
|
/// @return
|
|
|
|
/// A process object for the newly created process.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
For example,
|
|
|
|
|
|
|
|
process = target.Launch(self.dbg.GetListener(), None, None,
|
|
|
|
None, '/tmp/stdout.txt', None,
|
|
|
|
None, 0, False, error)
|
|
|
|
|
|
|
|
launches a new process by passing nothing for both the args and the envs
|
|
|
|
and redirect the standard output of the inferior to the /tmp/stdout.txt
|
|
|
|
file. It does not specify a working directory so that the debug server
|
|
|
|
will use its idea of what the current working directory is for the
|
|
|
|
inferior. Also, we ask the debugger not to stop the inferior at the
|
|
|
|
entry point. If no breakpoint is specified for the inferior, it should
|
|
|
|
run to completion if no user interaction is required.
|
|
|
|
") Launch;
|
|
|
|
lldb::SBProcess
|
|
|
|
Launch (SBListener &listener,
|
|
|
|
char const **argv,
|
|
|
|
char const **envp,
|
|
|
|
const char *stdin_path,
|
|
|
|
const char *stdout_path,
|
|
|
|
const char *stderr_path,
|
|
|
|
const char *working_directory,
|
|
|
|
uint32_t launch_flags, // See LaunchFlags
|
|
|
|
bool stop_at_entry,
|
|
|
|
lldb::SBError& error);
|
|
|
|
|
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Launch a new process with sensible defaults.
|
|
|
|
///
|
|
|
|
/// @param[in] argv
|
|
|
|
/// The argument array.
|
|
|
|
///
|
|
|
|
/// @param[in] envp
|
|
|
|
/// The environment array.
|
|
|
|
///
|
|
|
|
/// @param[in] working_directory
|
|
|
|
/// The working directory to have the child process run in
|
|
|
|
///
|
|
|
|
/// Default: listener
|
|
|
|
/// Set to the target's debugger (SBTarget::GetDebugger())
|
|
|
|
///
|
|
|
|
/// Default: launch_flags
|
|
|
|
/// Empty launch flags
|
|
|
|
///
|
|
|
|
/// Default: stdin_path
|
|
|
|
/// Default: stdout_path
|
|
|
|
/// Default: stderr_path
|
|
|
|
/// A pseudo terminal will be used.
|
|
|
|
///
|
|
|
|
/// @return
|
|
|
|
/// A process object for the newly created process.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
For example,
|
|
|
|
|
|
|
|
process = target.LaunchSimple(['X', 'Y', 'Z'], None, os.getcwd())
|
|
|
|
|
|
|
|
launches a new process by passing 'X', 'Y', 'Z' as the args to the
|
|
|
|
executable.
|
|
|
|
") LaunchSimple;
|
|
|
|
lldb::SBProcess
|
|
|
|
LaunchSimple (const char **argv,
|
|
|
|
const char **envp,
|
|
|
|
const char *working_directory);
|
|
|
|
|
2012-02-24 13:03:03 +08:00
|
|
|
lldb::SBProcess
|
|
|
|
Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
|
|
|
|
|
|
|
|
lldb::SBProcess
|
|
|
|
Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
|
|
|
|
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Attach to process with pid.
|
|
|
|
///
|
|
|
|
/// @param[in] listener
|
|
|
|
/// An optional listener that will receive all process events.
|
|
|
|
/// If \a listener is valid then \a listener will listen to all
|
|
|
|
/// process events. If not valid, then this target's debugger
|
|
|
|
/// (SBTarget::GetDebugger()) will listen to all process events.
|
|
|
|
///
|
|
|
|
/// @param[in] pid
|
|
|
|
/// The process ID to attach to.
|
|
|
|
///
|
|
|
|
/// @param[out]
|
|
|
|
/// An error explaining what went wrong if attach fails.
|
|
|
|
///
|
|
|
|
/// @return
|
|
|
|
/// A process object for the attached process.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
") AttachToProcessWithID;
|
|
|
|
lldb::SBProcess
|
|
|
|
AttachToProcessWithID (SBListener &listener,
|
|
|
|
lldb::pid_t pid,
|
|
|
|
lldb::SBError& error);
|
|
|
|
|
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Attach to process with name.
|
|
|
|
///
|
|
|
|
/// @param[in] listener
|
|
|
|
/// An optional listener that will receive all process events.
|
|
|
|
/// If \a listener is valid then \a listener will listen to all
|
|
|
|
/// process events. If not valid, then this target's debugger
|
|
|
|
/// (SBTarget::GetDebugger()) will listen to all process events.
|
|
|
|
///
|
|
|
|
/// @param[in] name
|
|
|
|
/// Basename of process to attach to.
|
|
|
|
///
|
|
|
|
/// @param[in] wait_for
|
|
|
|
/// If true wait for a new instance of 'name' to be launched.
|
|
|
|
///
|
|
|
|
/// @param[out]
|
|
|
|
/// An error explaining what went wrong if attach fails.
|
|
|
|
///
|
|
|
|
/// @return
|
|
|
|
/// A process object for the attached process.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
") AttachToProcessWithName;
|
|
|
|
lldb::SBProcess
|
|
|
|
AttachToProcessWithName (SBListener &listener,
|
|
|
|
const char *name,
|
|
|
|
bool wait_for,
|
|
|
|
lldb::SBError& error);
|
|
|
|
|
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Connect to a remote debug server with url.
|
|
|
|
///
|
|
|
|
/// @param[in] listener
|
|
|
|
/// An optional listener that will receive all process events.
|
|
|
|
/// If \a listener is valid then \a listener will listen to all
|
|
|
|
/// process events. If not valid, then this target's debugger
|
|
|
|
/// (SBTarget::GetDebugger()) will listen to all process events.
|
|
|
|
///
|
|
|
|
/// @param[in] url
|
|
|
|
/// The url to connect to, e.g., 'connect://localhost:12345'.
|
|
|
|
///
|
|
|
|
/// @param[in] plugin_name
|
|
|
|
/// The plugin name to be used; can be NULL.
|
|
|
|
///
|
|
|
|
/// @param[out]
|
|
|
|
/// An error explaining what went wrong if the connect fails.
|
|
|
|
///
|
|
|
|
/// @return
|
|
|
|
/// A process object for the connected process.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
") ConnectRemote;
|
|
|
|
lldb::SBProcess
|
|
|
|
ConnectRemote (SBListener &listener,
|
|
|
|
const char *url,
|
|
|
|
const char *plugin_name,
|
|
|
|
SBError& error);
|
|
|
|
|
|
|
|
lldb::SBFileSpec
|
|
|
|
GetExecutable ();
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
bool
|
|
|
|
AddModule (lldb::SBModule &module);
|
|
|
|
|
|
|
|
lldb::SBModule
|
|
|
|
AddModule (const char *path,
|
|
|
|
const char *triple,
|
|
|
|
const char *uuid);
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
uint32_t
|
|
|
|
GetNumModules () const;
|
|
|
|
|
|
|
|
lldb::SBModule
|
|
|
|
GetModuleAtIndex (uint32_t idx);
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
bool
|
|
|
|
RemoveModule (lldb::SBModule module);
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
lldb::SBDebugger
|
|
|
|
GetDebugger() const;
|
|
|
|
|
|
|
|
lldb::SBModule
|
|
|
|
FindModule (const lldb::SBFileSpec &file_spec);
|
|
|
|
|
2012-01-29 14:07:39 +08:00
|
|
|
lldb::ByteOrder
|
|
|
|
GetByteOrder ();
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetAddressByteSize();
|
|
|
|
|
|
|
|
const char *
|
|
|
|
GetTriple ();
|
|
|
|
|
2011-09-24 08:52:29 +08:00
|
|
|
lldb::SBError
|
|
|
|
SetSectionLoadAddress (lldb::SBSection section,
|
|
|
|
lldb::addr_t section_base_addr);
|
|
|
|
|
|
|
|
lldb::SBError
|
|
|
|
ClearSectionLoadAddress (lldb::SBSection section);
|
|
|
|
|
|
|
|
lldb::SBError
|
|
|
|
SetModuleLoadAddress (lldb::SBModule module,
|
|
|
|
int64_t sections_offset);
|
|
|
|
|
|
|
|
lldb::SBError
|
|
|
|
ClearModuleLoadAddress (lldb::SBModule module);
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Find functions by name.
|
|
|
|
///
|
|
|
|
/// @param[in] name
|
|
|
|
/// The name of the function we are looking for.
|
|
|
|
///
|
|
|
|
/// @param[in] name_type_mask
|
|
|
|
/// A logical OR of one or more FunctionNameType enum bits that
|
|
|
|
/// indicate what kind of names should be used when doing the
|
|
|
|
/// lookup. Bits include fully qualified names, base names,
|
|
|
|
/// C++ methods, or ObjC selectors.
|
|
|
|
/// See FunctionNameType for more details.
|
|
|
|
///
|
|
|
|
/// @return
|
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 09:44:54 +08:00
|
|
|
/// A lldb::SBSymbolContextList that gets filled in with all of
|
|
|
|
/// the symbol contexts for all the matches.
|
2011-07-17 05:15:39 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
") FindFunctions;
|
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 09:44:54 +08:00
|
|
|
lldb::SBSymbolContextList
|
2011-07-17 05:15:39 +08:00
|
|
|
FindFunctions (const char *name,
|
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 09:44:54 +08:00
|
|
|
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
|
2011-07-30 03:53:35 +08:00
|
|
|
|
|
|
|
lldb::SBType
|
|
|
|
FindFirstType (const char* type);
|
|
|
|
|
|
|
|
lldb::SBTypeList
|
|
|
|
FindTypes (const char* type);
|
2011-07-17 05:15:39 +08:00
|
|
|
|
2011-09-13 08:29:56 +08:00
|
|
|
lldb::SBSourceManager
|
|
|
|
GetSourceManager ();
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
%feature("docstring", "
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
/// Find global and static variables by name.
|
|
|
|
///
|
|
|
|
/// @param[in] name
|
|
|
|
/// The name of the global or static variable we are looking
|
|
|
|
/// for.
|
|
|
|
///
|
|
|
|
/// @param[in] max_matches
|
|
|
|
/// Allow the number of matches to be limited to \a max_matches.
|
|
|
|
///
|
|
|
|
/// @return
|
|
|
|
/// A list of matched variables in an SBValueList.
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
") FindGlobalVariables;
|
|
|
|
lldb::SBValueList
|
|
|
|
FindGlobalVariables (const char *name,
|
|
|
|
uint32_t max_matches);
|
|
|
|
|
|
|
|
void
|
|
|
|
Clear ();
|
|
|
|
|
2011-07-23 00:46:35 +08:00
|
|
|
lldb::SBAddress
|
|
|
|
ResolveLoadAddress (lldb::addr_t vm_addr);
|
2011-07-17 05:15:39 +08:00
|
|
|
|
|
|
|
SBSymbolContext
|
|
|
|
ResolveSymbolContextForAddress (const SBAddress& addr,
|
|
|
|
uint32_t resolve_scope);
|
|
|
|
|
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateByLocation (const char *file, uint32_t line);
|
|
|
|
|
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
|
|
|
|
|
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
|
|
|
|
|
2011-10-11 09:18:55 +08:00
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateByName (const char *symbol_name,
|
|
|
|
uint32_t func_name_type, // Logical OR one or more FunctionNameType enum bits
|
|
|
|
const SBFileSpecList &module_list,
|
|
|
|
const SBFileSpecList &comp_unit_list);
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
|
|
|
|
|
2011-09-21 09:17:13 +08:00
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateBySourceRegex (const char *source_regex, const lldb::SBFileSpec &source_file, const char *module_name = NULL);
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
lldb::SBBreakpoint
|
|
|
|
BreakpointCreateByAddress (addr_t address);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetNumBreakpoints () const;
|
|
|
|
|
|
|
|
lldb::SBBreakpoint
|
|
|
|
GetBreakpointAtIndex (uint32_t idx) const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
BreakpointDelete (break_id_t break_id);
|
|
|
|
|
|
|
|
lldb::SBBreakpoint
|
|
|
|
FindBreakpointByID (break_id_t break_id);
|
|
|
|
|
|
|
|
bool
|
|
|
|
EnableAllBreakpoints ();
|
|
|
|
|
|
|
|
bool
|
|
|
|
DisableAllBreakpoints ();
|
|
|
|
|
|
|
|
bool
|
|
|
|
DeleteAllBreakpoints ();
|
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
uint32_t
|
2011-10-14 02:08:26 +08:00
|
|
|
GetNumWatchpoints () const;
|
|
|
|
|
|
|
|
lldb::SBWatchpoint
|
|
|
|
GetWatchpointAtIndex (uint32_t idx) const;
|
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
bool
|
2011-10-14 02:08:26 +08:00
|
|
|
DeleteWatchpoint (lldb::watch_id_t watch_id);
|
|
|
|
|
|
|
|
lldb::SBWatchpoint
|
|
|
|
FindWatchpointByID (lldb::watch_id_t watch_id);
|
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
bool
|
2011-10-14 02:08:26 +08:00
|
|
|
EnableAllWatchpoints ();
|
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
bool
|
2011-10-14 02:08:26 +08:00
|
|
|
DisableAllWatchpoints ();
|
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
bool
|
2011-10-14 02:08:26 +08:00
|
|
|
DeleteAllWatchpoints ();
|
|
|
|
|
|
|
|
lldb::SBWatchpoint
|
|
|
|
WatchAddress (lldb::addr_t addr,
|
|
|
|
size_t size,
|
|
|
|
bool read,
|
|
|
|
bool write);
|
|
|
|
|
2011-09-27 09:19:20 +08:00
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
lldb::SBBroadcaster
|
|
|
|
GetBroadcaster () const;
|
2011-12-15 07:49:37 +08:00
|
|
|
|
|
|
|
lldb::SBInstructionList
|
|
|
|
GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
bool
|
2011-11-13 14:57:31 +08:00
|
|
|
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
|
2012-01-29 14:07:39 +08:00
|
|
|
|
|
|
|
%pythoncode %{
|
2012-02-01 16:09:32 +08:00
|
|
|
class modules_access(object):
|
|
|
|
'''A helper object that will lazily hand out lldb.SBModule objects for a target when supplied an index, or by full or partial path.'''
|
|
|
|
def __init__(self, sbtarget):
|
|
|
|
self.sbtarget = sbtarget
|
|
|
|
|
|
|
|
def __len__(self):
|
|
|
|
if self.sbtarget:
|
|
|
|
return self.sbtarget.GetNumModules()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
def __getitem__(self, key):
|
|
|
|
num_modules = self.sbtarget.GetNumModules()
|
|
|
|
if type(key) is int:
|
|
|
|
if key < num_modules:
|
|
|
|
return self.sbtarget.GetModuleAtIndex(key)
|
|
|
|
elif type(key) is str:
|
|
|
|
if key.find('/') == -1:
|
|
|
|
for idx in range(num_modules):
|
|
|
|
module = self.sbtarget.GetModuleAtIndex(idx)
|
|
|
|
if module.file.basename == key:
|
|
|
|
return module
|
|
|
|
else:
|
|
|
|
for idx in range(num_modules):
|
|
|
|
module = self.sbtarget.GetModuleAtIndex(idx)
|
|
|
|
if module.file.fullpath == key:
|
|
|
|
return module
|
|
|
|
# See if the string is a UUID
|
|
|
|
the_uuid = uuid.UUID(key)
|
|
|
|
if the_uuid:
|
|
|
|
for idx in range(num_modules):
|
|
|
|
module = self.sbtarget.GetModuleAtIndex(idx)
|
|
|
|
if module.uuid == the_uuid:
|
|
|
|
return module
|
|
|
|
elif type(key) is uuid.UUID:
|
|
|
|
for idx in range(num_modules):
|
|
|
|
module = self.sbtarget.GetModuleAtIndex(idx)
|
|
|
|
if module.uuid == key:
|
|
|
|
return module
|
|
|
|
elif type(key) is re.SRE_Pattern:
|
|
|
|
matching_modules = []
|
|
|
|
for idx in range(num_modules):
|
|
|
|
module = self.sbtarget.GetModuleAtIndex(idx)
|
|
|
|
re_match = key.search(module.path.fullpath)
|
|
|
|
if re_match:
|
|
|
|
matching_modules.append(module)
|
|
|
|
return matching_modules
|
|
|
|
else:
|
|
|
|
print "error: unsupported item type: %s" % type(key)
|
|
|
|
return None
|
|
|
|
|
|
|
|
def get_modules_access_object(self):
|
2012-02-03 11:22:53 +08:00
|
|
|
'''An accessor function that returns a modules_access() object which allows lazy module access from a lldb.SBTarget object.'''
|
2012-02-01 16:09:32 +08:00
|
|
|
return self.modules_access (self)
|
|
|
|
|
|
|
|
def get_modules_array(self):
|
2012-02-03 11:22:53 +08:00
|
|
|
'''An accessor function that returns a list() that contains all modules in a lldb.SBTarget object.'''
|
2012-02-01 16:09:32 +08:00
|
|
|
modules = []
|
|
|
|
for idx in range(self.GetNumModules()):
|
|
|
|
modules.append(self.GetModuleAtIndex(idx))
|
|
|
|
return modules
|
|
|
|
|
|
|
|
__swig_getmethods__["modules"] = get_modules_array
|
|
|
|
if _newclass: x = property(get_modules_array, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["module"] = get_modules_access_object
|
|
|
|
if _newclass: x = property(get_modules_access_object, None)
|
|
|
|
|
2012-01-29 14:07:39 +08:00
|
|
|
__swig_getmethods__["process"] = GetProcess
|
|
|
|
if _newclass: x = property(GetProcess, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["executable"] = GetExecutable
|
|
|
|
if _newclass: x = property(GetExecutable, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["debugger"] = GetDebugger
|
|
|
|
if _newclass: x = property(GetDebugger, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["num_breakpoints"] = GetNumBreakpoints
|
|
|
|
if _newclass: x = property(GetNumBreakpoints, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["num_watchpoints"] = GetNumWatchpoints
|
|
|
|
if _newclass: x = property(GetNumWatchpoints, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["broadcaster"] = GetBroadcaster
|
|
|
|
if _newclass: x = property(GetBroadcaster, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["byte_order"] = GetByteOrder
|
|
|
|
if _newclass: x = property(GetByteOrder, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["addr_size"] = GetAddressByteSize
|
|
|
|
if _newclass: x = property(GetAddressByteSize, None)
|
|
|
|
|
|
|
|
__swig_getmethods__["triple"] = GetTriple
|
|
|
|
if _newclass: x = property(GetTriple, None)
|
|
|
|
%}
|
|
|
|
|
2011-07-17 05:15:39 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace lldb
|