[Lldb-commits] [PATCH] D12556: Introduce new address class eAddressClassDataIntermixedCode

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 2 08:16:28 PDT 2015


tberghammer created this revision.
tberghammer added a reviewer: clayborg.
tberghammer added a subscriber: lldb-commits.
Herald added a subscriber: aemerson.

Introduce new address class eAddressClassDataIntermixedCode

It is used for marking data what is intermixed into the code section
on arm/aarch64. It is used during opcode load address calculation to
treat these addresses as code locations.

Treating these addresses as code required because of the following
edge case:

bx <addr>   // Non-tail call in a no return function
[data-pool] // Marked with $d mapping symbol

The return address of the function call will point to the data pool but
we have to treat it as code so the StackFrame can calculate the symbols
correctly.

Note: Other possible solution is to ignore the mapping symbols and decide the address class only based on the LSB of the symbol names. It will solve this issue, but will throw away some data what might be useful (e.g. to disable breakpoint setting in an address section)

http://reviews.llvm.org/D12556

Files:
  include/lldb/lldb-enumerations.h
  source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  source/Target/Target.cpp

Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2084,6 +2084,7 @@
         case eAddressClassCode:
         case eAddressClassCodeAlternateISA:
         case eAddressClassRuntime:
+        case eAddressClassDataIntermixedCode:
             // Check if bit zero it no set?
             if ((code_addr & 1ull) == 0)
             {
@@ -2129,6 +2130,7 @@
         case eAddressClassCode:
         case eAddressClassCodeAlternateISA:
         case eAddressClassRuntime:
+        case eAddressClassDataIntermixedCode:
             opcode_addr &= ~(1ull);
             break;
         }
Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -2000,7 +2000,7 @@
                         else if (symbol_name_ref == "$d" || symbol_name_ref.startswith("$d."))
                         {
                             // $d[.<any>]* - marks a data item sequence (e.g. lit pool)
-                            m_address_class_map[symbol.st_value] = eAddressClassData;
+                            m_address_class_map[symbol.st_value] = eAddressClassDataIntermixedCode;
                         }
                     }
                     continue;
@@ -2024,7 +2024,7 @@
                         else if (symbol_name_ref == "$d" || symbol_name_ref.startswith("$d."))
                         {
                             // $d[.<any>]* - marks a data item sequence (e.g. lit pool)
-                            m_address_class_map[symbol.st_value] = eAddressClassData;
+                            m_address_class_map[symbol.st_value] = eAddressClassDataIntermixedCode;
                         }
                     }
 
Index: include/lldb/lldb-enumerations.h
===================================================================
--- include/lldb/lldb-enumerations.h
+++ include/lldb/lldb-enumerations.h
@@ -781,6 +781,7 @@
         eAddressClassCode,
         eAddressClassCodeAlternateISA,
         eAddressClassData,
+        eAddressClassDataIntermixedCode,
         eAddressClassDebug,
         eAddressClassRuntime
     };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12556.33811.patch
Type: text/x-patch
Size: 2305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150902/b39adeb4/attachment-0001.bin>


More information about the lldb-commits mailing list