Author: Michał Górny
Date: 2021-10-25T20:05:29+02:00
New Revision: 26c584f4f1a3359bcb31b357ec020e7b8038c10c

URL: 
https://github.com/llvm/llvm-project/commit/26c584f4f1a3359bcb31b357ec020e7b8038c10c
DIFF: 
https://github.com/llvm/llvm-project/commit/26c584f4f1a3359bcb31b357ec020e7b8038c10c.diff

LOG: [lldb] [gdb-remote] Remove HardcodeARMRegisters() hack

HardcodeARMRegisters() is a hack that was supposed to be used "until
we can get an updated debugserver down on the devices".  Since it was
introduced back in 2012, there is a good chance that the debugserver
has been updated at least once since then.  Removing this code makes
transition to the new DynamicRegisterInfo API easier.

Differential Revision: https://reviews.llvm.org/D111491

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
    lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Removed: 
    


################################################################################
diff  --git 
a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 80294aefc4108..9410c9bd83ec4 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -815,266 +815,3 @@ bool 
GDBRemoteDynamicRegisterInfo::UpdateARM64SVERegistersInfos(uint64_t vg) {
   ConfigureOffsets();
   return true;
 }
-
-void GDBRemoteDynamicRegisterInfo::HardcodeARMRegisters(bool from_scratch) {
-  // For Advanced SIMD and VFP register mapping.
-  static uint32_t g_d0_regs[] = {26, 27, LLDB_INVALID_REGNUM};  // (s0, s1)
-  static uint32_t g_d1_regs[] = {28, 29, LLDB_INVALID_REGNUM};  // (s2, s3)
-  static uint32_t g_d2_regs[] = {30, 31, LLDB_INVALID_REGNUM};  // (s4, s5)
-  static uint32_t g_d3_regs[] = {32, 33, LLDB_INVALID_REGNUM};  // (s6, s7)
-  static uint32_t g_d4_regs[] = {34, 35, LLDB_INVALID_REGNUM};  // (s8, s9)
-  static uint32_t g_d5_regs[] = {36, 37, LLDB_INVALID_REGNUM};  // (s10, s11)
-  static uint32_t g_d6_regs[] = {38, 39, LLDB_INVALID_REGNUM};  // (s12, s13)
-  static uint32_t g_d7_regs[] = {40, 41, LLDB_INVALID_REGNUM};  // (s14, s15)
-  static uint32_t g_d8_regs[] = {42, 43, LLDB_INVALID_REGNUM};  // (s16, s17)
-  static uint32_t g_d9_regs[] = {44, 45, LLDB_INVALID_REGNUM};  // (s18, s19)
-  static uint32_t g_d10_regs[] = {46, 47, LLDB_INVALID_REGNUM}; // (s20, s21)
-  static uint32_t g_d11_regs[] = {48, 49, LLDB_INVALID_REGNUM}; // (s22, s23)
-  static uint32_t g_d12_regs[] = {50, 51, LLDB_INVALID_REGNUM}; // (s24, s25)
-  static uint32_t g_d13_regs[] = {52, 53, LLDB_INVALID_REGNUM}; // (s26, s27)
-  static uint32_t g_d14_regs[] = {54, 55, LLDB_INVALID_REGNUM}; // (s28, s29)
-  static uint32_t g_d15_regs[] = {56, 57, LLDB_INVALID_REGNUM}; // (s30, s31)
-  static uint32_t g_q0_regs[] = {
-      26, 27, 28, 29, LLDB_INVALID_REGNUM}; // (d0, d1) -> (s0, s1, s2, s3)
-  static uint32_t g_q1_regs[] = {
-      30, 31, 32, 33, LLDB_INVALID_REGNUM}; // (d2, d3) -> (s4, s5, s6, s7)
-  static uint32_t g_q2_regs[] = {
-      34, 35, 36, 37, LLDB_INVALID_REGNUM}; // (d4, d5) -> (s8, s9, s10, s11)
-  static uint32_t g_q3_regs[] = {
-      38, 39, 40, 41, LLDB_INVALID_REGNUM}; // (d6, d7) -> (s12, s13, s14, s15)
-  static uint32_t g_q4_regs[] = {
-      42, 43, 44, 45, LLDB_INVALID_REGNUM}; // (d8, d9) -> (s16, s17, s18, s19)
-  static uint32_t g_q5_regs[] = {
-      46, 47, 48, 49,
-      LLDB_INVALID_REGNUM}; // (d10, d11) -> (s20, s21, s22, s23)
-  static uint32_t g_q6_regs[] = {
-      50, 51, 52, 53,
-      LLDB_INVALID_REGNUM}; // (d12, d13) -> (s24, s25, s26, s27)
-  static uint32_t g_q7_regs[] = {
-      54, 55, 56, 57,
-      LLDB_INVALID_REGNUM}; // (d14, d15) -> (s28, s29, s30, s31)
-  static uint32_t g_q8_regs[] = {59, 60, LLDB_INVALID_REGNUM};  // (d16, d17)
-  static uint32_t g_q9_regs[] = {61, 62, LLDB_INVALID_REGNUM};  // (d18, d19)
-  static uint32_t g_q10_regs[] = {63, 64, LLDB_INVALID_REGNUM}; // (d20, d21)
-  static uint32_t g_q11_regs[] = {65, 66, LLDB_INVALID_REGNUM}; // (d22, d23)
-  static uint32_t g_q12_regs[] = {67, 68, LLDB_INVALID_REGNUM}; // (d24, d25)
-  static uint32_t g_q13_regs[] = {69, 70, LLDB_INVALID_REGNUM}; // (d26, d27)
-  static uint32_t g_q14_regs[] = {71, 72, LLDB_INVALID_REGNUM}; // (d28, d29)
-  static uint32_t g_q15_regs[] = {73, 74, LLDB_INVALID_REGNUM}; // (d30, d31)
-
-  // This is our array of composite registers, with each element coming from
-  // the above register mappings.
-  static uint32_t *g_composites[] = {
-      g_d0_regs,  g_d1_regs,  g_d2_regs,  g_d3_regs,  g_d4_regs,  g_d5_regs,
-      g_d6_regs,  g_d7_regs,  g_d8_regs,  g_d9_regs,  g_d10_regs, g_d11_regs,
-      g_d12_regs, g_d13_regs, g_d14_regs, g_d15_regs, g_q0_regs,  g_q1_regs,
-      g_q2_regs,  g_q3_regs,  g_q4_regs,  g_q5_regs,  g_q6_regs,  g_q7_regs,
-      g_q8_regs,  g_q9_regs,  g_q10_regs, g_q11_regs, g_q12_regs, g_q13_regs,
-      g_q14_regs, g_q15_regs};
-
-  // clang-format off
-    static RegisterInfo g_register_infos[] = {
-//   NAME     ALT     SZ   OFF  ENCODING          FORMAT          EH_FRAME     
        DWARF                GENERIC                 PROCESS PLUGIN  LLDB    
VALUE REGS    INVALIDATE REGS
-//   ======   ======  ===  ===  =============     ==========      
===================  ===================  ======================  ============= 
  ====    ==========    ===============
-    { "r0",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r0,  
        dwarf_r0,            LLDB_REGNUM_GENERIC_ARG1,0,               0 },     
nullptr,           nullptr },
-    { "r1",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r1,  
        dwarf_r1,            LLDB_REGNUM_GENERIC_ARG2,1,               1 },     
nullptr,           nullptr },
-    { "r2",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r2,  
        dwarf_r2,            LLDB_REGNUM_GENERIC_ARG3,2,               2 },     
nullptr,           nullptr },
-    { "r3",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r3,  
        dwarf_r3,            LLDB_REGNUM_GENERIC_ARG4,3,               3 },     
nullptr,           nullptr },
-    { "r4",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r4,  
        dwarf_r4,            LLDB_INVALID_REGNUM,     4,               4 },     
nullptr,           nullptr },
-    { "r5",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r5,  
        dwarf_r5,            LLDB_INVALID_REGNUM,     5,               5 },     
nullptr,           nullptr },
-    { "r6",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r6,  
        dwarf_r6,            LLDB_INVALID_REGNUM,     6,               6 },     
nullptr,           nullptr },
-    { "r7",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r7,  
        dwarf_r7,            LLDB_REGNUM_GENERIC_FP,  7,               7 },     
nullptr,           nullptr },
-    { "r8",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r8,  
        dwarf_r8,            LLDB_INVALID_REGNUM,     8,               8 },     
nullptr,           nullptr },
-    { "r9",  nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r9,  
        dwarf_r9,            LLDB_INVALID_REGNUM,     9,               9 },     
nullptr,           nullptr },
-    { "r10", nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r10, 
        dwarf_r10,           LLDB_INVALID_REGNUM,    10,              10 },     
nullptr,           nullptr },
-    { "r11", nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r11, 
        dwarf_r11,           LLDB_INVALID_REGNUM,    11,              11 },     
nullptr,           nullptr },
-    { "r12", nullptr,   4,   0, eEncodingUint,    eFormatHex,   { ehframe_r12, 
        dwarf_r12,           LLDB_INVALID_REGNUM,    12,              12 },     
nullptr,           nullptr },
-    { "sp",     "r13",  4,   0, eEncodingUint,    eFormatHex,   { ehframe_sp,  
        dwarf_sp,            LLDB_REGNUM_GENERIC_SP, 13,              13 },     
nullptr,           nullptr },
-    { "lr",     "r14",  4,   0, eEncodingUint,    eFormatHex,   { ehframe_lr,  
        dwarf_lr,            LLDB_REGNUM_GENERIC_RA, 14,              14 },     
nullptr,           nullptr },
-    { "pc",     "r15",  4,   0, eEncodingUint,    eFormatHex,   { ehframe_pc,  
        dwarf_pc,            LLDB_REGNUM_GENERIC_PC, 15,              15 },     
nullptr,           nullptr },
-    { "f0",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    16,           
   16 },     nullptr,           nullptr },
-    { "f1",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    17,           
   17 },     nullptr,           nullptr },
-    { "f2",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    18,           
   18 },     nullptr,           nullptr },
-    { "f3",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    19,           
   19 },     nullptr,           nullptr },
-    { "f4",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    20,           
   20 },     nullptr,           nullptr },
-    { "f5",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    21,           
   21 },     nullptr,           nullptr },
-    { "f6",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    22,           
   22 },     nullptr,           nullptr },
-    { "f7",  nullptr,  12,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    23,           
   23 },     nullptr,           nullptr },
-    { "fps", nullptr,   4,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    24,           
   24 },     nullptr,           nullptr },
-    { "cpsr","flags",   4,   0, eEncodingUint,    eFormatHex,   { 
ehframe_cpsr,        dwarf_cpsr,          LLDB_INVALID_REGNUM,    25,           
   25 },     nullptr,           nullptr },
-    { "s0",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s0,            LLDB_INVALID_REGNUM,    26,           
   26 },     nullptr,           nullptr },
-    { "s1",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s1,            LLDB_INVALID_REGNUM,    27,           
   27 },     nullptr,           nullptr },
-    { "s2",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s2,            LLDB_INVALID_REGNUM,    28,           
   28 },     nullptr,           nullptr },
-    { "s3",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s3,            LLDB_INVALID_REGNUM,    29,           
   29 },     nullptr,           nullptr },
-    { "s4",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s4,            LLDB_INVALID_REGNUM,    30,           
   30 },     nullptr,           nullptr },
-    { "s5",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s5,            LLDB_INVALID_REGNUM,    31,           
   31 },     nullptr,           nullptr },
-    { "s6",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s6,            LLDB_INVALID_REGNUM,    32,           
   32 },     nullptr,           nullptr },
-    { "s7",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s7,            LLDB_INVALID_REGNUM,    33,           
   33 },     nullptr,           nullptr },
-    { "s8",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s8,            LLDB_INVALID_REGNUM,    34,           
   34 },     nullptr,           nullptr },
-    { "s9",  nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s9,            LLDB_INVALID_REGNUM,    35,           
   35 },     nullptr,           nullptr },
-    { "s10", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s10,           LLDB_INVALID_REGNUM,    36,           
   36 },     nullptr,           nullptr },
-    { "s11", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s11,           LLDB_INVALID_REGNUM,    37,           
   37 },     nullptr,           nullptr },
-    { "s12", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s12,           LLDB_INVALID_REGNUM,    38,           
   38 },     nullptr,           nullptr },
-    { "s13", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s13,           LLDB_INVALID_REGNUM,    39,           
   39 },     nullptr,           nullptr },
-    { "s14", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s14,           LLDB_INVALID_REGNUM,    40,           
   40 },     nullptr,           nullptr },
-    { "s15", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s15,           LLDB_INVALID_REGNUM,    41,           
   41 },     nullptr,           nullptr },
-    { "s16", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s16,           LLDB_INVALID_REGNUM,    42,           
   42 },     nullptr,           nullptr },
-    { "s17", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s17,           LLDB_INVALID_REGNUM,    43,           
   43 },     nullptr,           nullptr },
-    { "s18", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s18,           LLDB_INVALID_REGNUM,    44,           
   44 },     nullptr,           nullptr },
-    { "s19", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s19,           LLDB_INVALID_REGNUM,    45,           
   45 },     nullptr,           nullptr },
-    { "s20", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s20,           LLDB_INVALID_REGNUM,    46,           
   46 },     nullptr,           nullptr },
-    { "s21", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s21,           LLDB_INVALID_REGNUM,    47,           
   47 },     nullptr,           nullptr },
-    { "s22", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s22,           LLDB_INVALID_REGNUM,    48,           
   48 },     nullptr,           nullptr },
-    { "s23", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s23,           LLDB_INVALID_REGNUM,    49,           
   49 },     nullptr,           nullptr },
-    { "s24", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s24,           LLDB_INVALID_REGNUM,    50,           
   50 },     nullptr,           nullptr },
-    { "s25", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s25,           LLDB_INVALID_REGNUM,    51,           
   51 },     nullptr,           nullptr },
-    { "s26", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s26,           LLDB_INVALID_REGNUM,    52,           
   52 },     nullptr,           nullptr },
-    { "s27", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s27,           LLDB_INVALID_REGNUM,    53,           
   53 },     nullptr,           nullptr },
-    { "s28", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s28,           LLDB_INVALID_REGNUM,    54,           
   54 },     nullptr,           nullptr },
-    { "s29", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s29,           LLDB_INVALID_REGNUM,    55,           
   55 },     nullptr,           nullptr },
-    { "s30", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s30,           LLDB_INVALID_REGNUM,    56,           
   56 },     nullptr,           nullptr },
-    { "s31", nullptr,   4,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_s31,           LLDB_INVALID_REGNUM,    57,           
   57 },     nullptr,           nullptr },
-    { "fpscr",nullptr,  4,   0, eEncodingUint,    eFormatHex,   { 
LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM, LLDB_INVALID_REGNUM,    58,           
   58 },     nullptr,           nullptr },
-    { "d16", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d16,           LLDB_INVALID_REGNUM,    59,           
   59 },     nullptr,           nullptr },
-    { "d17", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d17,           LLDB_INVALID_REGNUM,    60,           
   60 },     nullptr,           nullptr },
-    { "d18", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d18,           LLDB_INVALID_REGNUM,    61,           
   61 },     nullptr,           nullptr },
-    { "d19", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d19,           LLDB_INVALID_REGNUM,    62,           
   62 },     nullptr,           nullptr },
-    { "d20", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d20,           LLDB_INVALID_REGNUM,    63,           
   63 },     nullptr,           nullptr },
-    { "d21", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d21,           LLDB_INVALID_REGNUM,    64,           
   64 },     nullptr,           nullptr },
-    { "d22", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d22,           LLDB_INVALID_REGNUM,    65,           
   65 },     nullptr,           nullptr },
-    { "d23", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d23,           LLDB_INVALID_REGNUM,    66,           
   66 },     nullptr,           nullptr },
-    { "d24", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d24,           LLDB_INVALID_REGNUM,    67,           
   67 },     nullptr,           nullptr },
-    { "d25", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d25,           LLDB_INVALID_REGNUM,    68,           
   68 },     nullptr,           nullptr },
-    { "d26", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d26,           LLDB_INVALID_REGNUM,    69,           
   69 },     nullptr,           nullptr },
-    { "d27", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d27,           LLDB_INVALID_REGNUM,    70,           
   70 },     nullptr,           nullptr },
-    { "d28", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d28,           LLDB_INVALID_REGNUM,    71,           
   71 },     nullptr,           nullptr },
-    { "d29", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d29,           LLDB_INVALID_REGNUM,    72,           
   72 },     nullptr,           nullptr },
-    { "d30", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d30,           LLDB_INVALID_REGNUM,    73,           
   73 },     nullptr,           nullptr },
-    { "d31", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d31,           LLDB_INVALID_REGNUM,    74,           
   74 },     nullptr,           nullptr },
-    { "d0",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d0,            LLDB_INVALID_REGNUM,    75,           
   75 },   g_d0_regs,           nullptr },
-    { "d1",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d1,            LLDB_INVALID_REGNUM,    76,           
   76 },   g_d1_regs,           nullptr },
-    { "d2",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d2,            LLDB_INVALID_REGNUM,    77,           
   77 },   g_d2_regs,           nullptr },
-    { "d3",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d3,            LLDB_INVALID_REGNUM,    78,           
   78 },   g_d3_regs,           nullptr },
-    { "d4",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d4,            LLDB_INVALID_REGNUM,    79,           
   79 },   g_d4_regs,           nullptr },
-    { "d5",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d5,            LLDB_INVALID_REGNUM,    80,           
   80 },   g_d5_regs,           nullptr },
-    { "d6",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d6,            LLDB_INVALID_REGNUM,    81,           
   81 },   g_d6_regs,           nullptr },
-    { "d7",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d7,            LLDB_INVALID_REGNUM,    82,           
   82 },   g_d7_regs,           nullptr },
-    { "d8",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d8,            LLDB_INVALID_REGNUM,    83,           
   83 },   g_d8_regs,           nullptr },
-    { "d9",  nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d9,            LLDB_INVALID_REGNUM,    84,           
   84 },   g_d9_regs,           nullptr },
-    { "d10", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d10,           LLDB_INVALID_REGNUM,    85,           
   85 },  g_d10_regs,           nullptr },
-    { "d11", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d11,           LLDB_INVALID_REGNUM,    86,           
   86 },  g_d11_regs,           nullptr },
-    { "d12", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d12,           LLDB_INVALID_REGNUM,    87,           
   87 },  g_d12_regs,           nullptr },
-    { "d13", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d13,           LLDB_INVALID_REGNUM,    88,           
   88 },  g_d13_regs,           nullptr },
-    { "d14", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d14,           LLDB_INVALID_REGNUM,    89,           
   89 },  g_d14_regs,           nullptr },
-    { "d15", nullptr,   8,   0, eEncodingIEEE754, eFormatFloat, { 
LLDB_INVALID_REGNUM, dwarf_d15,           LLDB_INVALID_REGNUM,    90,           
   90 },  g_d15_regs,           nullptr },
-    { "q0",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q0,    LLDB_INVALID_REGNUM,    91,              91 
},   g_q0_regs,           nullptr },
-    { "q1",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q1,    LLDB_INVALID_REGNUM,    92,              92 
},   g_q1_regs,           nullptr },
-    { "q2",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q2,    LLDB_INVALID_REGNUM,    93,              93 
},   g_q2_regs,           nullptr },
-    { "q3",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q3,    LLDB_INVALID_REGNUM,    94,              94 
},   g_q3_regs,           nullptr },
-    { "q4",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q4,    LLDB_INVALID_REGNUM,    95,              95 
},   g_q4_regs,           nullptr },
-    { "q5",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q5,    LLDB_INVALID_REGNUM,    96,              96 
},   g_q5_regs,           nullptr },
-    { "q6",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q6,    LLDB_INVALID_REGNUM,    97,              97 
},   g_q6_regs,           nullptr },
-    { "q7",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q7,    LLDB_INVALID_REGNUM,    98,              98 
},   g_q7_regs,           nullptr },
-    { "q8",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q8,    LLDB_INVALID_REGNUM,    99,              99 
},   g_q8_regs,           nullptr },
-    { "q9",  nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q9,    LLDB_INVALID_REGNUM,   100,             100 
},   g_q9_regs,           nullptr },
-    { "q10", nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q10,   LLDB_INVALID_REGNUM,   101,             101 
},  g_q10_regs,           nullptr },
-    { "q11", nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q11,   LLDB_INVALID_REGNUM,   102,             102 
},  g_q11_regs,           nullptr },
-    { "q12", nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q12,   LLDB_INVALID_REGNUM,   103,             103 
},  g_q12_regs,           nullptr },
-    { "q13", nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q13,   LLDB_INVALID_REGNUM,   104,             104 
},  g_q13_regs,           nullptr },
-    { "q14", nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q14,   LLDB_INVALID_REGNUM,   105,             105 
},  g_q14_regs,           nullptr },
-    { "q15", nullptr,   16,  0, eEncodingVector,  eFormatVectorOfUInt8, { 
LLDB_INVALID_REGNUM, dwarf_q15,   LLDB_INVALID_REGNUM,   106,             106 
},  g_q15_regs,           nullptr }
-    };
-  // clang-format on
-
-  static const uint32_t num_registers = llvm::array_lengthof(g_register_infos);
-  static ConstString gpr_reg_set("General Purpose Registers");
-  static ConstString sfp_reg_set("Software Floating Point Registers");
-  static ConstString vfp_reg_set("Floating Point Registers");
-  size_t i;
-  if (from_scratch) {
-    // Calculate the offsets of the registers
-    // Note that the layout of the "composite" registers (d0-d15 and q0-q15)
-    // which comes after the "primordial" registers is important.  This enables
-    // us to calculate the offset of the composite register by using the offset
-    // of its first primordial register.  For example, to calculate the offset
-    // of q0, use s0's offset.
-    if (g_register_infos[2].byte_offset == 0) {
-      uint32_t byte_offset = 0;
-      for (i = 0; i < num_registers; ++i) {
-        // For primordial registers, increment the byte_offset by the byte_size
-        // to arrive at the byte_offset for the next register.  Otherwise, we
-        // have a composite register whose offset can be calculated by
-        // consulting the offset of its first primordial register.
-        if (!g_register_infos[i].value_regs) {
-          g_register_infos[i].byte_offset = byte_offset;
-          byte_offset += g_register_infos[i].byte_size;
-        } else {
-          const uint32_t first_primordial_reg =
-              g_register_infos[i].value_regs[0];
-          g_register_infos[i].byte_offset =
-              g_register_infos[first_primordial_reg].byte_offset;
-        }
-      }
-    }
-    for (i = 0; i < num_registers; ++i) {
-      if (i <= 15 || i == 25)
-        AddRegister(g_register_infos[i], gpr_reg_set);
-      else if (i <= 24)
-        AddRegister(g_register_infos[i], sfp_reg_set);
-      else
-        AddRegister(g_register_infos[i], vfp_reg_set);
-    }
-  } else {
-    // Add composite registers to our primordial registers, then.
-    const size_t num_composites = llvm::array_lengthof(g_composites);
-    const size_t num_dynamic_regs = GetNumRegisters();
-    const size_t num_common_regs = num_registers - num_composites;
-    RegisterInfo *g_comp_register_infos = g_register_infos + num_common_regs;
-
-    // First we need to validate that all registers that we already have match
-    // the non composite regs. If so, then we can add the registers, else we
-    // need to bail
-    bool match = true;
-    if (num_dynamic_regs == num_common_regs) {
-      for (i = 0; match && i < num_dynamic_regs; ++i) {
-        // Make sure all register names match
-        if (m_regs[i].name && g_register_infos[i].name) {
-          if (strcmp(m_regs[i].name, g_register_infos[i].name)) {
-            match = false;
-            break;
-          }
-        }
-
-        // Make sure all register byte sizes match
-        if (m_regs[i].byte_size != g_register_infos[i].byte_size) {
-          match = false;
-          break;
-        }
-      }
-    } else {
-      // Wrong number of registers.
-      match = false;
-    }
-    // If "match" is true, then we can add extra registers.
-    if (match) {
-      for (i = 0; i < num_composites; ++i) {
-        const uint32_t first_primordial_reg =
-            g_comp_register_infos[i].value_regs[0];
-        const char *reg_name = g_register_infos[first_primordial_reg].name;
-        if (reg_name && reg_name[0]) {
-          for (uint32_t j = 0; j < num_dynamic_regs; ++j) {
-            const RegisterInfo *reg_info = GetRegisterInfoAtIndex(j);
-            // Find a matching primordial register info entry.
-            if (reg_info && reg_info->name &&
-                ::strcasecmp(reg_info->name, reg_name) == 0) {
-              // The name matches the existing primordial entry. Find and
-              // assign the offset, and then add this composite register entry.
-              g_comp_register_infos[i].byte_offset = reg_info->byte_offset;
-              AddRegister(g_comp_register_infos[i], vfp_reg_set);
-            }
-          }
-        }
-      }
-    }
-  }
-}

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h 
b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
index 648bcbaa8bc7f..83c809c5aab6b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.h
@@ -38,7 +38,6 @@ class GDBRemoteDynamicRegisterInfo final : public 
DynamicRegisterInfo {
 
   ~GDBRemoteDynamicRegisterInfo() override = default;
 
-  void HardcodeARMRegisters(bool from_scratch);
   bool UpdateARM64SVERegistersInfos(uint64_t vg);
 };
 

diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 2823acfb66751..d128be3ab07bb 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -515,31 +515,7 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool 
force) {
     }
   }
 
-  if (!registers.empty()) {
-    AddRemoteRegisters(registers, arch_to_use);
-    return;
-  }
-
-  // We didn't get anything if the accumulated reg_num is zero.  See if we are
-  // debugging ARM and fill with a hard coded register set until we can get an
-  // updated debugserver down on the devices. On the other hand, if the
-  // accumulated reg_num is positive, see if we can add composite registers to
-  // the existing primordial ones.
-  bool from_scratch = (m_register_info_sp->GetNumRegisters() == 0);
-
-  if (!target_arch.IsValid()) {
-    if (arch_to_use.IsValid() &&
-        (arch_to_use.GetMachine() == llvm::Triple::arm ||
-         arch_to_use.GetMachine() == llvm::Triple::thumb) &&
-        arch_to_use.GetTriple().getVendor() == llvm::Triple::Apple)
-      m_register_info_sp->HardcodeARMRegisters(from_scratch);
-  } else if (target_arch.GetMachine() == llvm::Triple::arm ||
-             target_arch.GetMachine() == llvm::Triple::thumb) {
-    m_register_info_sp->HardcodeARMRegisters(from_scratch);
-  }
-
-  // At this point, we can finalize our register info.
-  m_register_info_sp->Finalize(GetTarget().GetArchitecture());
+  AddRemoteRegisters(registers, arch_to_use);
 }
 
 Status ProcessGDBRemote::WillLaunch(lldb_private::Module *module) {


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to