hanchenye-llvm-project/lldb/source
Greg Clayton ef8180a3f6 <rdar://problem/14972424>
When debugging with the GDB remote in LLDB, LLDB uses special packets to discover the
registers on the remote server. When those packets aren't supported, LLDB doesn't
know what the registers look like. This checkin implements a setting that can be used
to specify a python file that contains the registers definitions. The setting is:

(lldb) settings set plugin.process.gdb-remote.target-definition-file /path/to/module.py

Inside module there should be a function:

def get_dynamic_setting(target, setting_name):

This dynamic setting function is handed the "target" which is a SBTarget, and the 
"setting_name", which is the name of the dynamic setting to retrieve. For the GDB
remote target definition the setting name is 'gdb-server-target-definition'. The
return value is a dictionary that follows the same format as the OperatingSystem
plugins follow. I have checked in an example file that implements the x86_64 GDB
register set for people to see:

    examples/python/x86_64_target_definition.py
    
This allows LLDB to debug to any archticture that is support and allows users to
define the registers contexts when the discovery packets (qRegisterInfo, qHostInfo)
are not supported by the remote GDB server.

A few benefits of doing this in Python:
1 - The dynamic register context was already supported in the OperatingSystem plug-in
2 - Register contexts can use all of the LLDB enumerations and definitions for things
    like lldb::Format, lldb::Encoding, generic register numbers, invalid registers 
    numbers, etc.
3 - The code that generates the register context can use the program to calculate the
    register context contents (like offsets, register numbers, and more)
4 - True dynamic detection could be used where variables and types could be read from 
    the target program itself in order to determine which registers are available since
    the target is passed into the python function.
    
This is designed to be used instead of XML since it is more dynamic and code flow and
functions can be used to make the dictionary.

llvm-svn: 192646
2013-10-15 00:14:28 +00:00
..
API <rdar://problem/13635174> 2013-10-11 19:48:25 +00:00
Breakpoint Report the summed hit count in the breakpoint line. 2013-10-12 00:40:02 +00:00
Commands <rdar://problem/13635174> 2013-10-11 19:48:25 +00:00
Core <rdar://problem/15191078> 2013-10-11 22:03:48 +00:00
DataFormatters <rdar://problem/12632394> 2013-10-08 20:59:02 +00:00
Expression Implemented TruncInst in the IRInterpreter. 2013-10-11 19:45:00 +00:00
Host Add error checking to 'cmd' buffer as it may not be available (ie. in the case of exec). 2013-10-09 19:23:34 +00:00
Interpreter <rdar://problem/14972424> 2013-10-15 00:14:28 +00:00
Plugins <rdar://problem/14972424> 2013-10-15 00:14:28 +00:00
Symbol Merge RegisterContextPOSIX_x86_64 and RegisterContextPOSIX_i386 into RegisterContextPOSIX_x86 2013-10-10 00:16:10 +00:00
Target <rdar://problem/13635174> 2013-10-11 19:48:25 +00:00
Utility Convert to UNIX line endings. 2013-09-25 10:37:32 +00:00
CMakeLists.txt Convert to UNIX line endings. 2013-09-25 10:37:32 +00:00
Makefile Remove LLDB dependency on xcodeworkspace (on Linux) for version number 2013-02-28 16:51:15 +00:00
lldb-log.cpp The output of 'log list' was missing a few of the lldb channels: 2013-09-12 01:48:59 +00:00
lldb.cpp Revert my commit 191617. It added a clang warning (Thanks to Ed Maste). Add a comment 2013-10-14 14:06:28 +00:00