Move dwarf2_frame_state_reg.exp_len to union .loc
authorYao Qi <yao.qi@linaro.org>
Fri, 11 Aug 2017 08:30:02 +0000 (09:30 +0100)
committerYao Qi <yao.qi@linaro.org>
Fri, 11 Aug 2017 08:30:02 +0000 (09:30 +0100)
dwarf2_frame_state_reg.exp_len is only used together with .loc.exp, so
it makes more sense to exp_len to the union as well.

gdb:

2017-08-11  Yao Qi  <yao.qi@linaro.org>

* dwarf2-frame.h (struct dwarf2_frame_state_reg) <exp_len>: Remove.
<loc.exp>: New field.
* dwarf2-frame.c (execute_cfa_program): Update.
(dwarf2_frame_prev_register): Update.

gdb/ChangeLog
gdb/dwarf2-frame.c
gdb/dwarf2-frame.h

index f670f99959040408b8bde614982b3c8a8c416e70..f8f47bbde79d136b1a51a8a16421fc1fdfba3465 100644 (file)
@@ -1,3 +1,10 @@
+2017-08-11  Yao Qi  <yao.qi@linaro.org>
+
+       * dwarf2-frame.h (struct dwarf2_frame_state_reg) <exp_len>: Remove.
+       <loc.exp>: New field.
+       * dwarf2-frame.c (execute_cfa_program): Update.
+       (dwarf2_frame_prev_register): Update.
+
 2017-08-10  Pedro Alves  <palves@redhat.com>
 
        * common/gdb_unique_ptr.h (xfree_deleter<T[]>): Define.
index d7f985b5b045a0cafe937b9a6f4816ea9cd4c18e..191f60ad5ec63ca47a36a20d9643c49293cf09ef 100644 (file)
@@ -561,8 +561,8 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
              reg = dwarf2_frame_adjust_regnum (gdbarch, reg, eh_frame_p);
              dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
              insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, &utmp);
-             fs->regs.reg[reg].loc.exp = insn_ptr;
-             fs->regs.reg[reg].exp_len = utmp;
+             fs->regs.reg[reg].loc.exp.start = insn_ptr;
+             fs->regs.reg[reg].loc.exp.len = utmp;
              fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_EXP;
              insn_ptr += utmp;
              break;
@@ -599,8 +599,8 @@ bad CFI data; mismatched DW_CFA_restore_state at %s"),
              insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, &reg);
              dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
              insn_ptr = safe_read_uleb128 (insn_ptr, insn_end, &utmp);
-             fs->regs.reg[reg].loc.exp = insn_ptr;
-             fs->regs.reg[reg].exp_len = utmp;
+             fs->regs.reg[reg].loc.exp.start = insn_ptr;
+             fs->regs.reg[reg].loc.exp.len = utmp;
              fs->regs.reg[reg].how = DWARF2_FRAME_REG_SAVED_VAL_EXP;
              insn_ptr += utmp;
              break;
@@ -1286,8 +1286,8 @@ dwarf2_frame_prev_register (struct frame_info *this_frame, void **this_cache,
       return frame_unwind_got_register (this_frame, regnum, realnum);
 
     case DWARF2_FRAME_REG_SAVED_EXP:
-      addr = execute_stack_op (cache->reg[regnum].loc.exp,
-                              cache->reg[regnum].exp_len,
+      addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
+                              cache->reg[regnum].loc.exp.len,
                               cache->addr_size, cache->text_offset,
                               this_frame, cache->cfa, 1);
       return frame_unwind_got_memory (this_frame, regnum, addr);
@@ -1297,8 +1297,8 @@ dwarf2_frame_prev_register (struct frame_info *this_frame, void **this_cache,
       return frame_unwind_got_constant (this_frame, regnum, addr);
 
     case DWARF2_FRAME_REG_SAVED_VAL_EXP:
-      addr = execute_stack_op (cache->reg[regnum].loc.exp,
-                              cache->reg[regnum].exp_len,
+      addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
+                              cache->reg[regnum].loc.exp.len,
                               cache->addr_size, cache->text_offset,
                               this_frame, cache->cfa, 1);
       return frame_unwind_got_constant (this_frame, regnum, addr);
index 9e8668ea7a1a265622335359bad94d8f05bd0937..69a7a2037f3f02fcd581dee95894f38aa99c5825 100644 (file)
@@ -74,11 +74,14 @@ struct dwarf2_frame_state_reg
   union {
     LONGEST offset;
     ULONGEST reg;
-    const gdb_byte *exp;
+    struct
+    {
+      const gdb_byte *start;
+      ULONGEST len;
+    } exp;
     struct value *(*fn) (struct frame_info *this_frame, void **this_cache,
                         int regnum);
   } loc;
-  ULONGEST exp_len;
   enum dwarf2_frame_reg_rule how;
 };