[Lldb-commits] [PATCH] Add setting for breakpoint PC adjustment from remote stubs which don't back PC up.

Ewan Crawford ewan at codeplay.com
Fri Jun 26 11:53:47 PDT 2015


Hi clayborg,

Currently `m_breakpoint_pc_offset` is only set using the python target definition file. This variable adjusts the PC for a breakpoint hit when the remote stub, like gdbserver, hasn't backed up the PC. 

The introduction of reading XML target definition files from the remote however means that the XML target def has priority over the python target definition. So in cases where the XML is provided, the python target def isn't used. In such a situation there is no way to provide the breakpoint PC offset. 

This patch allows the breakpoint offset variable to set using a settting.  An alternative however could be to prioritize the python target definition, over the XML target definition.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D10775

Files:
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -107,6 +107,9 @@
     {
         { "packet-timeout" , OptionValue::eTypeUInt64 , true , 1, NULL, NULL, "Specify the default packet timeout in seconds." },
         { "target-definition-file" , OptionValue::eTypeFileSpec , true, 0 , NULL, NULL, "The file that provides the description for remote target registers." },
+        { "breakpoint-pc-offset", OptionValue::eTypeSInt64, true, 0, NULL, NULL, "Architecture specific PC offset when a breakpoint is hit. "
+                                                                                 "Needed if debug stub does not rollback PC after hitting a breakpoint. "
+                                                                                 "For negative values, use '--' before settings variable." },
         {  NULL            , OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL  }
     };
     
@@ -113,7 +116,8 @@
     enum
     {
         ePropertyPacketTimeout,
-        ePropertyTargetDefinitionFile
+        ePropertyTargetDefinitionFile,
+        ePropertyBreakpointOffset
     };
     
     class PluginProperties : public Properties
@@ -158,6 +162,13 @@
             const uint32_t idx = ePropertyTargetDefinitionFile;
             return m_collection_sp->GetPropertyAtIndexAsFileSpec (NULL, idx);
         }
+
+        int64_t
+        GetBreakpointOffset() const
+        {
+            const uint32_t idx = ePropertyBreakpointOffset;
+            return m_collection_sp->GetPropertyAtIndexAsSInt64(NULL, idx, 0);
+        }
     };
     
     typedef std::shared_ptr<PluginProperties> ProcessKDPPropertiesSP;
@@ -399,6 +410,10 @@
     const uint64_t timeout_seconds = GetGlobalPluginProperties()->GetPacketTimeout();
     if (timeout_seconds > 0)
         m_gdb_comm.SetPacketTimeout(timeout_seconds);
+
+    const int64_t settings_bp_offset = GetGlobalPluginProperties()->GetBreakpointOffset();
+    if (settings_bp_offset != 0)
+        m_breakpoint_pc_offset = settings_bp_offset;
 }
 
 //----------------------------------------------------------------------

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10775.28582.patch
Type: text/x-patch
Size: 2289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150626/e260e828/attachment.bin>


More information about the lldb-commits mailing list