[Lldb-commits] [PATCH] D12079: [MIPS] microMIPS breakpoints, disassembly and compressed addresses

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 15 14:01:30 PDT 2015


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

One last change to make line table parsing more efficient by not having to check the arch for every line table entry.


================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1131
@@ -1130,2 +1130,3 @@
     std::unique_ptr<LineSequence> sequence_ap;
+    ArchSpec arch;
 };
----------------
Maybe this should be a "lldb:addr_t addr_mask;" instead of the architecture. Then you determine the mask one time before you parse a line table and fill it in. 

================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1160-1170
@@ -1158,1 +1159,13 @@
         }
+
+        /*
+         * MIPS:
+         * The SymbolContext may not have a valid target, thus we may not be able
+         * to call Address::GetOpcodeLoadAddress() which would clear the bit #0
+         * for MIPS. Use ArchSpec to clear the bit #0.
+        */
+        lldb::addr_t file_addr = state.address;
+        if (info->arch.GetMachine() == llvm::Triple::mips || info->arch.GetMachine() == llvm::Triple::mipsel
+           || info->arch.GetMachine() == llvm::Triple::mips64 || info->arch.GetMachine() == llvm::Triple::mips64el)
+            file_addr = state.address & (~1ull);
+
----------------
Move this code to where the ParseDWARFLineTableCallbackInfo is filled in and fill in "addr_mask" as described above. Otherwise each time we append a line entry to a sequence we will be checking the arch over and over and over and over....

================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1173
@@ -1159,3 +1172,3 @@
         line_table->AppendLineEntryToSequence (info->sequence_ap.get(),
-                                               state.address,
+                                               file_addr,
                                                state.line,
----------------
change this line to:

```
file_addr & info->addr_mask,
```

================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1213
@@ -1199,2 +1212,3 @@
                     info.line_table = line_table_ap.get();
+                    GetObjectFile()->GetArchitecture(info.arch);
                     lldb::offset_t offset = cu_line_offset;
----------------
Fill in "info.addr_mask" here:
```
        /*
         * MIPS:
         * The SymbolContext may not have a valid target, thus we may not be able
         * to call Address::GetOpcodeLoadAddress() which would clear the bit #0
         * for MIPS. Use ArchSpec to clear the bit #0.
        */
        ArchSpec arch;
        GetObjectFile()->GetArchitecture(arch);
        switch (arch.GetMachine())
        {
        case llvm::Triple::mips:
        case llvm::Triple::mipsel:
        case llvm::Triple::mips64:
        case llvm::Triple::mips64el:
            info.addr_mask = ~((lldb::addr_t)1);
            break;
        default:
            info.addr_mask = ~((lldb::addr_t)0);
            break;
        }
```


Repository:
  rL LLVM

http://reviews.llvm.org/D12079





More information about the lldb-commits mailing list