* print_insn and streams
@ 2001-08-17 14:37 Keith Seitz
2001-08-17 15:15 ` John R. Moore
2001-08-20 22:58 ` Andrew Cagney
0 siblings, 2 replies; 3+ messages in thread
From: Keith Seitz @ 2001-08-17 14:37 UTC (permalink / raw)
To: gdb
Hi,
printcmd.c currently defines print_insn as:
static int
print_insn (CORE_ADDR memaddr, struct ui_file *stream)
{
if (TARGET_BYTE_ORDER == BIG_ENDIAN)
TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
else
TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
if (TARGET_ARCHITECTURE != NULL)
TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach;
/* else: should set .mach=0 but some disassemblers don't grok this */
return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO);
}
Is there some reason that it is ignoring the parameter stream? Can it not
just be set in the disasm info? (TARGET_PRINT_INSN_INFO->stream = stream;)
Curious.
Keith
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: print_insn and streams
2001-08-17 14:37 print_insn and streams Keith Seitz
@ 2001-08-17 15:15 ` John R. Moore
2001-08-20 22:58 ` Andrew Cagney
1 sibling, 0 replies; 3+ messages in thread
From: John R. Moore @ 2001-08-17 15:15 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb
> printcmd.c currently defines print_insn as:
>
> static int
> print_insn (CORE_ADDR memaddr, struct ui_file *stream)
> {
> if (TARGET_BYTE_ORDER == BIG_ENDIAN)
> TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
> else
> TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
>
> if (TARGET_ARCHITECTURE != NULL)
> TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach;
> /* else: should set .mach=0 but some disassemblers don't grok this */
>
> return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO);
> }
>
> Is there some reason that it is ignoring the parameter stream? Can it not
> just be set in the disasm info? (TARGET_PRINT_INSN_INFO->stream = stream;)
>
> Curious.
> Keith
When print_insn was first put in printcmd.c (-r1.108):
--------------------------------------------------------------
/* Print the instruction at address MEMADDR in debugged memory,
on STREAM. Returns length of the instruction, in bytes. */
int
print_insn (memaddr, stream)
CORE_ADDR memaddr;
GDB_FILE *stream;
{
disassemble_info info;
#define GDB_INIT_DISASSEMBLE_INFO(INFO, STREAM) \
(INFO).fprintf_func = (fprintf_ftype)fprintf_filtered, \
(INFO).stream = (STREAM), \
(INFO).read_memory_func = dis_asm_read_memory, \
(INFO).memory_error_func = dis_asm_memory_error, \
(INFO).print_address_func = dis_asm_print_address, \
(INFO).insn_info_valid = 0
GDB_INIT_DISASSEMBLE_INFO(info, stream);
/* If there's no disassembler, something is very wrong. */
if (tm_print_insn == NULL)
abort ();
return (*tm_print_insn) (memaddr, &info);
}
-------------------------------------------
"stream" was used until -r1.124
revision 1.124
date: 1996/07/15 23:54:22; author: grossman; state: Exp; lines: +11 -8
* defs.h printcmd.c: Create global disassemble_info structure
tm_print_insn_info.
* gdbtk.c (gdb_disassemble): Setup di.mach from
tm_print_insn_info.mach, and set endian from TARGET_BYTE_ORDER.
* i386-tdep.c (set_assembly_language_command): set
tm_print_insn_info.mach to the appropriate value for 386 or 8086
disassembly.
* printcmd.c (print_insn): Move init of disassembler_info to
_initialize_printcmd. Set endian for disassembler here.
* sparc-tdep.c: Set tm_print_insn_info.mach as appropriate to
select sparc/sparclite.
* config/sparc/{tm-sparc.h tm-sparclite.h}: Get rid of
TM_PRINT_INSN. Set TM_PRINT_INSN_MACH to
bfd_mach_sparc/bfd_mach_sparc_sparclite.
---------
The parameter was left in rather than removing and fixing all the
routines that call it.
FWIW,
John
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: print_insn and streams
2001-08-17 14:37 print_insn and streams Keith Seitz
2001-08-17 15:15 ` John R. Moore
@ 2001-08-20 22:58 ` Andrew Cagney
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2001-08-20 22:58 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb
> Hi,
>
> printcmd.c currently defines print_insn as:
>
> static int
> print_insn (CORE_ADDR memaddr, struct ui_file *stream)
> {
> if (TARGET_BYTE_ORDER == BIG_ENDIAN)
> TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG;
> else
> TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_LITTLE;
>
> if (TARGET_ARCHITECTURE != NULL)
> TARGET_PRINT_INSN_INFO->mach = TARGET_ARCHITECTURE->mach;
> /* else: should set .mach=0 but some disassemblers don't grok this */
>
> return TARGET_PRINT_INSN (memaddr, TARGET_PRINT_INSN_INFO);
> }
>
> Is there some reason that it is ignoring the parameter stream? Can it not
> just be set in the disasm info? (TARGET_PRINT_INSN_INFO->stream = stream;)
Keith,
have you looked at gdb/mi/mi-cmd-disas.c (yes the code is nasty) which
calls the TARGET_PRINT_INSN() with a ui-out builder.
If the main function was split in two would the second half do what
you're after? You can check the output by looking at the
mi-disassemble.exp test (or the doco which might be easier to read :-).
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-08-20 22:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-17 14:37 print_insn and streams Keith Seitz
2001-08-17 15:15 ` John R. Moore
2001-08-20 22:58 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox