This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sh-elf disassembly broken (Was: Re: RFC: Moving disassembler_command to cli land and using newer disassembler code)

I wrote:
> This patch:
> 2002-11-07  Fernando Nasser  <fnasser at redhat dot com>
>         * printcmd.c (disassemble_command): Remove obsolete function.
>         (_initialize_printcmd): Do not create disassemble command here.
>         * cli/cli-cmds.c (disassemble_command): New function.  Implements
>         disassemble command.
>         (init_cli_cmds): Create disassemble command here instead.
> breaks disassembly for sh-elf (just try to disassemble any
> function in any sh-elf object file).
> gdb_disassembly uses TARGET_PRINT_INSN_INFO->mach to initialize
> di.mach, but TARGET_PRINT_INSN_INFO->mach is never initialized.
> Before your patch, print_insn had set TARGET_PRINT_INSN_INFO->mach
> to TARGET_ARCHITECTURE->mach, which gets expanded to
> (gdbarch_bfd_arch_info (current_gdbarch))->mach .

And didn't get any reply.

So I had a go at writing a conservative patch, which handles the mach
field likee tui/tuiDisassem.c:tui_disassemble .

Although I have the feeling that TARGET_PRINT_INSN_INFO should be really
a local variable of print_insn, and if any information might be missing
in the gdbarch struct to initialize TARGET_PRINT_INSN_INFO and asm_info
in tui/tuiDisassem.c:tui_disassemble ,  that should rather be added to
the gdbarch struct.
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658
Mon Feb 24 19:59:50 2003  J"orn Rennecke <joern dot rennecke at superh dot com>

	* disasm.c (gdb_disassembly): If TARGET_ARCHITECTURE is non-zero,
	initialize di.mach from there.

Index: disasm.c
RCS file: /cvs/src/src/gdb/disasm.c,v
retrieving revision 1.4
diff -p -r1.4 disasm.c
*** disasm.c	3 Feb 2003 01:18:37 -0000	1.4
--- disasm.c	24 Feb 2003 19:59:47 -0000
*************** gdb_disassembly (struct ui_out *uiout,
*** 338,344 ****
--- 338,350 ----
        di_initialized = 1;
+   /* ??? TARGET_PRINT_INSN_INFO is undocumented and only initialized inside
+      printcmd.c:print_insn , and some strange hacks that access fields of
+      the variable that underlies the implementation of this macro.  */
    di.mach = TARGET_PRINT_INSN_INFO->mach;
+     di.mach = TARGET_ARCHITECTURE->mach;
      di.endian = BFD_ENDIAN_BIG;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]