This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
RFC: Keep 5 yr. old hack for MIPS16 on disassembler code
- From: Fernando Nasser <fnasser at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 30 Sep 2002 17:29:12 -0400
- Subject: RFC: Keep 5 yr. old hack for MIPS16 on disassembler code
- Organization: Red Hat , Inc. - Toronto
This hack was added 5+yrs ago to fix disassembler printing for MIPS16. The
instruction disassembler code itself is unaware of that -- the hack is only for
the address that is printed in front of the instructions.
This horrible macro is only defined for these MIPS16 machines, it is not a
general architecture macro (which would be transformed into a multiarch
function), so the ifdef.
I have filled the bug gdb/773 asking for these macros to be replaced by
something cleaner. But I don't know enough about mips16 to do anything about it
and if I leave this out of the code I will break that target. So I will have to
add it to the new disassembler code in disasm.c (this hack was on the old code
on printcmd.c) -- see attached patch.
I will check it in soon (unless someone fixes 773 first).
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
Index: disasm.c
===================================================================
RCS file: /cvs/src/src/gdb/disasm.c,v
retrieving revision 1.1
diff -c -p -r1.1 disasm.c
*** disasm.c 30 Sep 2002 15:57:25 -0000 1.1
--- disasm.c 30 Sep 2002 20:45:49 -0000
*************** dump_insns (struct ui_out *uiout, disass
*** 88,94 ****
int how_many, struct ui_stream *stb)
{
int num_displayed = 0;
! CORE_ADDR pc;
/* parts of the symbolic representation of the address */
int unmapped;
--- 88,94 ----
int how_many, struct ui_stream *stb)
{
int num_displayed = 0;
! CORE_ADDR pc, pc_masked;
/* parts of the symbolic representation of the address */
int unmapped;
*************** dump_insns (struct ui_out *uiout, disass
*** 97,103 ****
int offset;
int line;
! for (pc = low; pc < high;)
{
QUIT;
if (how_many >= 0)
--- 97,113 ----
int offset;
int line;
!
! /* Dump the specified range. */
! pc = low;
!
! #ifdef GDB_TARGET_MASK_DISAS_PC
! pc_masked = GDB_TARGET_MASK_DISAS_PC (pc);
! #else
! pc_masked = pc;
! #endif
!
! for (pc_masked; pc_masked < high;)
{
QUIT;
if (how_many >= 0)
*************** dump_insns (struct ui_out *uiout, disass
*** 108,114 ****
num_displayed++;
}
ui_out_tuple_begin (uiout, NULL);
! ui_out_field_core_addr (uiout, "address", pc);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename,
&line, &unmapped))
--- 118,124 ----
num_displayed++;
}
ui_out_tuple_begin (uiout, NULL);
! ui_out_field_core_addr (uiout, "address", pc_masked);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename,
&line, &unmapped))
*************** dump_insns (struct ui_out *uiout, disass
*** 128,133 ****
--- 138,148 ----
ui_file_rewind (stb->stream);
pc += TARGET_PRINT_INSN (pc, di);
+ #ifdef GDB_TARGET_MASK_DISAS_PC
+ pc_masked = GDB_TARGET_MASK_DISAS_PC (pc);
+ #else
+ pc_masked = pc;
+ #endif
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
ui_out_tuple_end (uiout);