aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2013-06-14 13:30:28 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2013-06-14 13:30:28 +0000
commite410add4157311809c0b580cf2303bd07c55ea1e (patch)
tree0c7d805e894dd462976744ceeb1c9fbad0eb55e0 /gas/config
parent6a50d470b71ce26110ef91d2679d4565d3a3192e (diff)
downloadgdb-e410add4157311809c0b580cf2303bd07c55ea1e.zip
gdb-e410add4157311809c0b580cf2303bd07c55ea1e.tar.gz
gdb-e410add4157311809c0b580cf2303bd07c55ea1e.tar.bz2
gas/
* dwarf2dbg.h (dwarf2_move_insn): Declare. * dwarf2dbg.c (line_subseg): Add pmove_tail. (get_line_subseg): Add create_p argument. Initialize pmove_tail. (dwarf2_gen_line_info_1): Update call accordingly. (dwarf2_move_insn): New function. * config/tc-mips.c (append_insn): Use dwarf2_move_insn. gas/testsuite/ * gas/mips/loc-swap-3.d, gas/mips/loc-swap-3.s: New test. * gas/mips/mips.exp: Run it.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-mips.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 468e40f..106f754 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -4373,22 +4373,19 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr,
branch_disp = method == APPEND_SWAP ? insn_length (history) : 0;
#ifdef OBJ_ELF
- /* The value passed to dwarf2_emit_insn is the distance between
- the beginning of the current instruction and the address that
- should be recorded in the debug tables. This is normally the
- current address.
-
- For MIPS16/microMIPS debug info we want to use ISA-encoded
- addresses, so we use -1 for an address higher by one than the
- current one.
-
- If the instruction produced is a branch that we will swap with
- the preceding instruction, then we add the displacement by which
- the branch will be moved backwards. This is more appropriate
- and for MIPS16/microMIPS code also prevents a debugger from
- placing a breakpoint in the middle of the branch (and corrupting
- code if software breakpoints are used). */
- dwarf2_emit_insn ((HAVE_CODE_COMPRESSION ? -1 : 0) + branch_disp);
+ dwarf2_emit_insn (0);
+ /* We want MIPS16 and microMIPS debug info to use ISA-encoded addresses,
+ so "move" the instruction address accordingly.
+
+ Also, it doesn't seem appropriate for the assembler to reorder .loc
+ entries. If this instruction is a branch that we are going to swap
+ with the previous instruction, the two instructions should be
+ treated as a unit, and the debug information for both instructions
+ should refer to the start of the branch sequence. Using the
+ current position is certainly wrong when swapping a 32-bit branch
+ and a 16-bit delay slot, since the current position would then be
+ in the middle of a branch. */
+ dwarf2_move_insn ((HAVE_CODE_COMPRESSION ? 1 : 0) - branch_disp);
#endif
relax32 = (mips_relax_branch