[Lldb-commits] [PATCH] D13154: [MIPS] Use Address::GetAddressClass() instead of elf flags to decide address space of an address

Bhushan Attarde via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 24 21:40:08 PDT 2015

bhushan created this revision.
bhushan added a reviewer: clayborg.
bhushan added subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, sagar, jaydeep.
bhushan set the repository for this revision to rL LLVM.

In MIPS, an application elf can contain mixed code (mips + micromips) i.e some functions in the application can be "micromips" and some functions can be MIPS-only (non-micromips).
Micromips functions has compressed addresses (bit #0 set) and MIPS functions has un-compressed addresses (bit #0 clear).
Such mixed-mode elf will have micromips specific bits set in its flags. That means "IsMicromips" will be true even for non-micromips address.

This patch fixes this by using Address::GetAddressClass() to decide which address space the address belongs to (instead of deciding this from elf's flags).




Index: source/Target/Target.cpp
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -2269,10 +2269,12 @@
         uint32_t loop_count = 0;
         Address resolved_addr;
         uint32_t arch_flags = m_arch.GetFlags ();
-        bool IsMips16 = arch_flags & ArchSpec::eMIPSAse_mips16;
-        bool IsMicromips = arch_flags & ArchSpec::eMIPSAse_micromips;
         SectionLoadList &section_load_list = GetSectionLoadList();
+        // Get opcode address
+        addr = GetOpcodeLoadAddress (addr, eAddressClassCode);
+        breakable_addr = addr;
         if (section_load_list.IsEmpty())
             // No sections are loaded, so we must assume we are not running yet
             // and need to operate only on file address.
@@ -2310,7 +2312,7 @@
         if (loop_count > 3)
             // Scan previous 6 bytes
-            if (IsMips16 | IsMicromips)
+            if (resolved_addr.GetAddressClass() == eAddressClassCodeAlternateISA)
                 loop_count = 3;
             // For mips-only, instructions are always 4 bytes, so scan previous 4 bytes only.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13154.35697.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150925/1cbd8f8c/attachment-0001.bin>

More information about the lldb-commits mailing list