diff options
author | Maciej W. Rozycki <macro@linux-mips.org> | 2011-07-04 19:27:28 +0000 |
---|---|---|
committer | Maciej W. Rozycki <macro@linux-mips.org> | 2011-07-04 19:27:28 +0000 |
commit | e3a82c8e754de197a7df9868003a324800ac80cb (patch) | |
tree | 981ed4790b0e0f36e20b0a11b34635f21e0aa6d8 /gas/config | |
parent | 7475b06c2068a2fa8e774f3cbe809e3d00218a72 (diff) | |
download | gdb-e3a82c8e754de197a7df9868003a324800ac80cb.zip gdb-e3a82c8e754de197a7df9868003a324800ac80cb.tar.gz gdb-e3a82c8e754de197a7df9868003a324800ac80cb.tar.bz2 |
gas/
* config/tc-mips.c (append_insn): Make sure DWARF-2 location
information is properly adjusted for branches that get swapped.
gas/testsuite/
* gas/mips/loc-swap.d: New test case for DWARF-2 location with
branch swapping.
* gas/mips/loc-swap-dis.d: Likewise.
* gas/mips/mips16@loc-swap.d: Likewise, MIPS16 version.
* gas/mips/mips16@loc-swap-dis.d: Likewise.
* gas/mips/loc-swap.s: Source for the new tests.
* gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-mips.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index cdcebf1..2b3e4dc 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -3454,10 +3454,20 @@ append_insn (struct mips_cl_insn *ip, expressionS *address_expr, #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. For MIPS16 debug info - we want to use ISA-encoded addresses, so we pass -1 for an - address higher by one than the current. */ - dwarf2_emit_insn (mips_opts.mips16 ? -1 : 0); + should be recorded in the debug tables. This is normally the + current address. + + For MIPS16 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 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 ((mips_opts.mips16 ? -1 : 0) + + (method == APPEND_SWAP ? insn_length (history) : 0)); #endif if (address_expr |