Re: Is this "gdb disassembler" code still needed?

Maciej W. Rozycki
2013-06-26T19:08:35Z

On Wed, 26 Jun 2013, Richard Sandiford wrote:

> opcodes/mips-dis.c has some code marked "For gdb disassembler, ...".
>
> (1) For jumps in the standard encoding:
>
> /* For gdb disassembler, force odd address on jalx. */
> if (info->flavour == bfd_target_unknown_flavour
> && strcmp (opp->name, "jalx") == 0)
> info->target |= 1;
>
> (2) For MIPS16 branches:
>
> if (pcrel && branch
> && info->flavour == bfd_target_unknown_flavour)
> /* For gdb disassembler, maintain odd address. */
> info->target |= 1;
>
> (3) For MIPS16 jumps:
>
> if (!jalx && info->flavour == bfd_target_unknown_flavour)
> /* For gdb disassembler, maintain odd address. */
> l |= 1;
>
> (4) For microMIPS jumps:
>
> /* For gdb disassembler, force odd address on jalx. */
> if (info->flavour == bfd_target_unknown_flavour
> && strcmp (op->name, "jalx") == 0)
> info->target |= 1;
>
> (4) seems like it's doing the opposite of (3), whereas I'd have expected
> it to do the same. It doesn't like microMIPS has the equivalent of (2).
> (Hope I'm reading this right.)
>
> Do you know if this special handling is still needed? If so, is the
> current behaviour intentional?

Thanks for the heads-up.

Hmm, it looks like some cleanup might be in order here, especially the
microMIPS stuff seems backwards (probably blindly copied from the standard
MIPS version whereas MIPS16 conditions stand here) and should be fixed.

Other than that I am fairly sure the behaviour is intentional, so except
from any microMIPS change to match the MIPS16 variant please refrain from
fiddling with these bits until I am done with the change proposed here:

http://sourceware.org/ml/binutils/2012-05/msg00183.html
http://sourceware.org/ml/binutils/2012-06/msg00114.html

Maciej