* [RFA] Multiarch tm_print_insn
@ 2001-08-21 16:26 Elena Zannoni
2001-08-21 17:33 ` Andrew Cagney
[not found] ` <3405-Wed22Aug2001084554+0300-eliz@is.elta.co.il>
0 siblings, 2 replies; 8+ messages in thread
From: Elena Zannoni @ 2001-08-21 16:26 UTC (permalink / raw)
To: gdb-patches
This patch multiarches tm_print_insn.
I changed all the direct callers to (*tm_print_insn), to use
the multiarch macro TARGET_PRINT_INSN.
If a target doesn't set the multiarch function, gdb falls back to
using the global, via an access function called legacy_print_insn.
Elena
2001-08-01 Elena Zannoni <ezannoni@redhat.com>
* gdbarch.sh: Move include of dis-asm.h so it is generated earlier
in gdbarch.h.
(TARGET_PRINT_INSN): Multiarch.
* gdbarch.h: Regenerate.
* gdbarch.c: Regenerate.
* arch-utils.c (legacy_print_insn): New function.
* arch-utils.h (legacy_print_insn): Export.
* cris-tdep.c (cris_delayed_get_disassembler): Use
TARGET_PRINT_INSN, instead of tm_print_insn.
* d10v-tdep.c (print_insn): Ditto.
* d30v-tdep.c (print_insn): Ditto.
* m32r-tdep.c (dump_insn): Ditto.
* v850-tdep.c (v850_scan_prologue): Ditto.
* mcore-tdep.c (mcore_dump_insn): Ditto.
* sh-tdep.c (sh_gdbarch_init): Set print_insn gdbarch field.
mi/ChangeLog
2001-08-21 Elena Zannoni <ezannoni@redhat.com>
* mi-cmd-disas.c (mi_cmd_disassemble): Use TARGET_PRINT_INSN,
instead of tm_print_insn.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.35
diff -u -p -r1.35 arch-utils.c
--- arch-utils.c 2001/08/15 15:29:55 1.35
+++ arch-utils.c 2001/08/21 22:35:31
@@ -146,6 +146,13 @@ generic_prologue_frameless_p (CORE_ADDR
#endif
}
+/* New/multi-arched targets should use the correct gdbarch field
+ instead of using this global pointer. */
+int
+legacy_print_insn (bfd_vma vma, disassemble_info *info)
+{
+ return (*tm_print_insn) (vma, info);
+}
/* Helper functions for INNER_THAN */
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.20
diff -u -p -r1.20 arch-utils.h
--- arch-utils.h 2001/08/15 15:29:55 1.20
+++ arch-utils.h 2001/08/21 22:35:32
@@ -47,6 +47,9 @@ extern gdbarch_return_value_on_stack_fty
/* Map onto old REGISTER_NAMES. */
extern char *legacy_register_name (int i);
+/* Accessor for old global function pointer for disassembly. */
+extern int legacy_print_insn (bfd_vma vma, disassemble_info *info);
+
/* Backward compatible call_dummy_words. */
extern LONGEST legacy_call_dummy_words[];
extern int legacy_sizeof_call_dummy_words;
Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 cris-tdep.c
--- cris-tdep.c 2001/07/16 08:52:41 1.1
+++ cris-tdep.c 2001/08/21 22:35:35
@@ -3532,7 +3532,7 @@ static int
cris_delayed_get_disassembler (bfd_vma addr, disassemble_info *info)
{
tm_print_insn = cris_get_disassembler (exec_bfd);
- return (*tm_print_insn) (addr, info);
+ return TARGET_PRINT_INSN (addr, info);
}
void
Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.23
diff -u -p -r1.23 d10v-tdep.c
--- d10v-tdep.c 2001/07/15 20:10:02 1.23
+++ d10v-tdep.c 2001/08/21 22:35:37
@@ -1239,7 +1239,7 @@ print_insn (CORE_ADDR memaddr, struct ui
tm_print_insn_info.endian = BFD_ENDIAN_BIG;
else
tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
- return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+ return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info);
}
static void
Index: d30v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d30v-tdep.c,v
retrieving revision 1.10
diff -u -p -r1.10 d30v-tdep.c
--- d30v-tdep.c 2001/07/15 20:10:02 1.10
+++ d30v-tdep.c 2001/08/21 22:35:38
@@ -1156,7 +1156,7 @@ print_insn (CORE_ADDR memaddr, struct ui
tm_print_insn_info.endian = BFD_ENDIAN_BIG;
else
tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
- return (*tm_print_insn) (memaddr, &tm_print_insn_info);
+ return TARGET_PRINT_INSN (memaddr, &tm_print_insn_info);
}
void
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.72
diff -u -p -r1.72 gdbarch.c
--- gdbarch.c 2001/08/15 15:29:55 1.72
+++ gdbarch.c 2001/08/21 22:35:42
@@ -249,6 +249,7 @@ struct gdbarch
gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
gdbarch_addr_bits_remove_ftype *addr_bits_remove;
gdbarch_software_single_step_ftype *software_single_step;
+ gdbarch_print_insn_ftype *print_insn;
gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
};
@@ -385,6 +386,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
/* startup_gdbarch() */
};
@@ -484,6 +486,7 @@ gdbarch_alloc (const struct gdbarch_info
gdbarch->extra_stack_alignment_needed = 1;
gdbarch->convert_from_func_ptr_addr = core_addr_identity;
gdbarch->addr_bits_remove = core_addr_identity;
+ gdbarch->print_insn = legacy_print_insn;
gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
/* gdbarch_alloc() */
@@ -780,6 +783,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
/* Skip verify of addr_bits_remove, invalid_p == 0 */
/* Skip verify of software_single_step, has predicate */
+ /* Skip verify of print_insn, invalid_p == 0 */
/* Skip verify of skip_trampoline_code, invalid_p == 0 */
}
@@ -1472,6 +1476,12 @@ gdbarch_dump (struct gdbarch *gdbarch, s
"SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)",
XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p)));
#endif
+#ifdef TARGET_PRINT_INSN
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "TARGET_PRINT_INSN(vma, info)",
+ XSTRING (TARGET_PRINT_INSN (vma, info)));
+#endif
#ifdef SKIP_TRAMPOLINE_CODE
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@@ -2210,6 +2220,13 @@ gdbarch_dump (struct gdbarch *gdbarch, s
(long) current_gdbarch->software_single_step
/*SOFTWARE_SINGLE_STEP ()*/);
#endif
+#ifdef TARGET_PRINT_INSN
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: TARGET_PRINT_INSN = 0x%08lx\n",
+ (long) current_gdbarch->print_insn
+ /*TARGET_PRINT_INSN ()*/);
+#endif
#ifdef SKIP_TRAMPOLINE_CODE
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
@@ -4328,6 +4345,24 @@ set_gdbarch_software_single_step (struct
gdbarch_software_single_step_ftype software_single_step)
{
gdbarch->software_single_step = software_single_step;
+}
+
+int
+gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, disassemble_info *info)
+{
+ if (gdbarch->print_insn == 0)
+ internal_error (__FILE__, __LINE__,
+ "gdbarch: gdbarch_print_insn invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_print_insn called\n");
+ return gdbarch->print_insn (vma, info);
+}
+
+void
+set_gdbarch_print_insn (struct gdbarch *gdbarch,
+ gdbarch_print_insn_ftype print_insn)
+{
+ gdbarch->print_insn = print_insn;
}
CORE_ADDR
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.59
diff -u -p -r1.59 gdbarch.h
--- gdbarch.h 2001/08/15 15:29:55 1.59
+++ gdbarch.h 2001/08/21 22:35:45
@@ -35,6 +35,8 @@
#ifndef GDBARCH_H
#define GDBARCH_H
+#include "dis-asm.h" /* Get defs for disassemble_info, which unfortunately is a typedef. */
+
struct frame_info;
struct value;
@@ -1948,6 +1950,23 @@ extern void set_gdbarch_software_single_
#endif
/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (TARGET_PRINT_INSN)
+#define TARGET_PRINT_INSN(vma, info) (legacy_print_insn (vma, info))
+#endif
+
+typedef int (gdbarch_print_insn_ftype) (bfd_vma vma, disassemble_info *info);
+extern int gdbarch_print_insn (struct gdbarch *gdbarch, bfd_vma vma, disassemble_info *info);
+extern void set_gdbarch_print_insn (struct gdbarch *gdbarch, gdbarch_print_insn_ftype *print_insn);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_PRINT_INSN)
+#error "Non multi-arch definition of TARGET_PRINT_INSN"
+#endif
+#if GDB_MULTI_ARCH
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_PRINT_INSN)
+#define TARGET_PRINT_INSN(vma, info) (gdbarch_print_insn (current_gdbarch, vma, info))
+#endif
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (SKIP_TRAMPOLINE_CODE)
#define SKIP_TRAMPOLINE_CODE(pc) (generic_skip_trampoline_code (pc))
#endif
@@ -2205,8 +2224,6 @@ extern const struct bfd_arch_info *targe
/* The target-system-dependent disassembler is semi-dynamic */
-#include "dis-asm.h" /* Get defs for disassemble_info */
-
extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
unsigned int len, disassemble_info *info);
@@ -2218,9 +2235,6 @@ extern void dis_asm_print_address (bfd_v
extern int (*tm_print_insn) (bfd_vma, disassemble_info*);
extern disassemble_info tm_print_insn_info;
-#ifndef TARGET_PRINT_INSN
-#define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info)
-#endif
#ifndef TARGET_PRINT_INSN_INFO
#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
#endif
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.76
diff -u -p -r1.76 gdbarch.sh
--- gdbarch.sh 2001/08/15 15:29:56 1.76
+++ gdbarch.sh 2001/08/21 22:35:47
@@ -539,6 +539,7 @@ f:2:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits
# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can
# single step. If not, then implement single step using breakpoints.
F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0
+f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0
f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
EOF
}
@@ -629,6 +630,8 @@ cat <<EOF
#ifndef GDBARCH_H
#define GDBARCH_H
+#include "dis-asm.h" /* Get defs for disassemble_info, which unfortunately is a typedef. */
+
struct frame_info;
struct value;
@@ -1048,8 +1051,6 @@ extern const struct bfd_arch_info *targe
/* The target-system-dependent disassembler is semi-dynamic */
-#include "dis-asm.h" /* Get defs for disassemble_info */
-
extern int dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr,
unsigned int len, disassemble_info *info);
@@ -1061,9 +1062,6 @@ extern void dis_asm_print_address (bfd_v
extern int (*tm_print_insn) (bfd_vma, disassemble_info*);
extern disassemble_info tm_print_insn_info;
-#ifndef TARGET_PRINT_INSN
-#define TARGET_PRINT_INSN(vma, info) (*tm_print_insn) (vma, info)
-#endif
#ifndef TARGET_PRINT_INSN_INFO
#define TARGET_PRINT_INSN_INFO (&tm_print_insn_info)
#endif
Index: m32r-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m32r-tdep.c,v
retrieving revision 1.6
diff -u -p -r1.6 m32r-tdep.c
--- m32r-tdep.c 2001/07/15 20:10:02 1.6
+++ m32r-tdep.c 2001/08/21 22:35:48
@@ -60,7 +60,7 @@ dump_insn (char *commnt, CORE_ADDR pc, i
{
printf_filtered (" %s %08x %08x ",
commnt, (unsigned int) pc, (unsigned int) insn);
- (*tm_print_insn) (pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (pc, &tm_print_insn_info);
printf_filtered ("\n");
}
#define insn_debug(args) { printf_filtered args; }
Index: mcore-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mcore-tdep.c,v
retrieving revision 1.10
diff -u -p -r1.10 mcore-tdep.c
--- mcore-tdep.c 2001/07/15 20:10:02 1.10
+++ mcore-tdep.c 2001/08/21 22:35:49
@@ -167,7 +167,7 @@ mcore_dump_insn (char *commnt, CORE_ADDR
{
printf_filtered ("MCORE: %s %08x %08x ",
commnt, (unsigned int) pc, (unsigned int) insn);
- (*tm_print_insn) (pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (pc, &tm_print_insn_info);
printf_filtered ("\n");
}
}
Index: sh-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh-tdep.c,v
retrieving revision 1.39
diff -u -p -r1.39 sh-tdep.c
--- sh-tdep.c 2001/08/01 18:39:23 1.39
+++ sh-tdep.c 2001/08/21 22:35:52
@@ -47,7 +47,6 @@
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
void (*sh_show_regs) (void);
-int (*print_sh_insn) (bfd_vma, disassemble_info*);
CORE_ADDR (*skip_prologue_hard_way) (CORE_ADDR);
void (*do_pseudo_register) (int);
@@ -1928,7 +1927,7 @@ sh_gdbarch_init (struct gdbarch_info inf
set_gdbarch_use_struct_convention (gdbarch, sh_use_struct_convention);
set_gdbarch_extract_struct_value_address (gdbarch, sh_extract_struct_value_address);
set_gdbarch_pop_frame (gdbarch, sh_pop_frame);
- print_sh_insn = gdb_print_insn_sh;
+ set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
skip_prologue_hard_way = sh_skip_prologue_hard_way;
do_pseudo_register = sh_do_pseudo_register;
@@ -2125,7 +2124,6 @@ sh_gdbarch_init (struct gdbarch_info inf
set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown);
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
set_gdbarch_ieee_float (gdbarch, 1);
- tm_print_insn = print_sh_insn;
return gdbarch;
}
Index: v850-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/v850-tdep.c,v
retrieving revision 1.11
diff -u -p -r1.11 v850-tdep.c
--- v850-tdep.c 2001/07/15 20:10:02 1.11
+++ v850-tdep.c 2001/08/21 22:35:52
@@ -361,7 +361,7 @@ v850_scan_prologue (CORE_ADDR pc, struct
#ifdef DEBUG
printf_filtered ("0x%.8lx ", (long) current_pc);
- (*tm_print_insn) (current_pc, &tm_print_insn_info);
+ TARGET_PRINT_INSN (current_pc, &tm_print_insn_info);
#endif
insn = read_memory_unsigned_integer (current_pc, 2);
Index: mi/mi-cmd-disas.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-disas.c,v
retrieving revision 1.11
diff -u -p -r1.11 mi-cmd-disas.c
--- mi-cmd-disas.c 2001/06/23 20:43:56 1.11
+++ mi-cmd-disas.c 2001/08/21 22:35:54
@@ -434,7 +434,7 @@ mi_cmd_disassemble (char *command, char
xfree (name);
ui_file_rewind (stb->stream);
- pc += (*tm_print_insn) (pc, &di);
+ pc += TARGET_PRINT_INSN (pc, &di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
ui_out_tuple_end (uiout);
@@ -482,7 +482,7 @@ mi_cmd_disassemble (char *command, char
xfree (name);
ui_file_rewind (stb->stream);
- pc += (*tm_print_insn) (pc, &di);
+ pc += TARGET_PRINT_INSN (pc, &di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
ui_out_tuple_end (uiout);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
2001-08-21 16:26 [RFA] Multiarch tm_print_insn Elena Zannoni
@ 2001-08-21 17:33 ` Andrew Cagney
2001-09-05 17:07 ` Elena Zannoni
[not found] ` <3405-Wed22Aug2001084554+0300-eliz@is.elta.co.il>
1 sibling, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2001-08-21 17:33 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
> This patch multiarches tm_print_insn.
> I changed all the direct callers to (*tm_print_insn), to use
> the multiarch macro TARGET_PRINT_INSN.
>
> If a target doesn't set the multiarch function, gdb falls back to
> using the global, via an access function called legacy_print_insn.
Er, wow, yes it works! Long ago when I first started multi-arching
stuff I put that one in the too hard basket.
Any way, ok by me.
--
Several things I noticed if you're looking for a second pass.
Both chris-tdep.c and d10v-tdep.c might as well initialize the
multi-arch field?
Should I add ``/tm_print_insn = /'' to the ARI?
The d10v-tdep.c, at least, has the same bug that Keith just fixed in
printcmd.c!!
Andrew
> Elena
>
> 2001-08-01 Elena Zannoni <ezannoni@redhat.com>
>
> * gdbarch.sh: Move include of dis-asm.h so it is generated earlier
> in gdbarch.h.
> (TARGET_PRINT_INSN): Multiarch.
> * gdbarch.h: Regenerate.
> * gdbarch.c: Regenerate.
>
> * arch-utils.c (legacy_print_insn): New function.
> * arch-utils.h (legacy_print_insn): Export.
>
> * cris-tdep.c (cris_delayed_get_disassembler): Use
> TARGET_PRINT_INSN, instead of tm_print_insn.
> * d10v-tdep.c (print_insn): Ditto.
> * d30v-tdep.c (print_insn): Ditto.
> * m32r-tdep.c (dump_insn): Ditto.
> * v850-tdep.c (v850_scan_prologue): Ditto.
> * mcore-tdep.c (mcore_dump_insn): Ditto.
> * sh-tdep.c (sh_gdbarch_init): Set print_insn gdbarch field.
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
[not found] ` <9003-Thu23Aug2001085323+0300-eliz@is.elta.co.il>
@ 2001-09-04 21:00 ` Elena Zannoni
2001-09-05 3:12 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Elena Zannoni @ 2001-09-04 21:00 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: ezannoni, gdb-patches
Eli Zaretskii writes:
> > From: Elena Zannoni <ezannoni@cygnus.com>
> > Date: Wed, 22 Aug 2001 18:19:14 -0400
> >
> > > > This patch multiarches tm_print_insn.
> > > > I changed all the direct callers to (*tm_print_insn), to use
> > > > the multiarch macro TARGET_PRINT_INSN.
> > >
> > > Should this macro be documented in gdbint.texinfo?
> >
> > In which section should it go?
>
> The section "Target conditionals" sounds about right.
How about this?
[Note: I don't know how to reference correctly the 'opcodes' library.]
Elena
2001-09-04 Elena Zannoni <ezannoni@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Add
explanation of TARGET_PRINT_INSN macro.
Index: gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.35
diff -u -p -r1.35 gdbint.texinfo
--- gdbint.texinfo 2001/08/15 14:47:53 1.35
+++ gdbint.texinfo 2001/09/05 03:59:40
@@ -3566,6 +3566,17 @@ If non-zero, the target has support for
watchpoints. @xref{Algorithms, watchpoints}, for more details and
other related macros.
+@item TARGET_PRINT_INSN (@var{addr}, @var{info})
+@findex TARGET_PRINT_INSN
+This is the function used by @value{GDBN} to print an assembly
+instruction. It prints the instruction at address @var{addr} in
+debugged memory abd returns the length of the instruction, in bytes. If
+a target doesn't define its own printing routine, it defaults to an
+accessor function for the global pointer @var{tm_print_insn}. This
+usually points to a function in the @code{opcodes} library
+(@xref{,,opcodes}). @var{info} is a structure defined in @code{opcodes}
+used to pass information to the instruction decoding routine.
+
@item USE_STRUCT_CONVENTION (@var{gcc_p}, @var{type})
@findex USE_STRUCT_CONVENTION
If defined, this must be an expression that is nonzero if a value of the
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
2001-09-04 21:00 ` Elena Zannoni
@ 2001-09-05 3:12 ` Eli Zaretskii
2001-09-05 11:58 ` Elena Zannoni
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2001-09-05 3:12 UTC (permalink / raw)
To: Elena Zannoni; +Cc: ezannoni, gdb-patches
On Wed, 5 Sep 2001, Elena Zannoni wrote:
> How about this?
Approved, with a few minor comments (see below).
Thanks!
> +debugged memory abd returns the length of the instruction, in bytes. If
^^^
A typo.
> +a target doesn't define its own printing routine, it defaults to an
> +accessor function for the global pointer @var{tm_print_insn}.
Isn't tm_print_insn a name of a real variable in GDB sources? If so,
it should have the @code markup; @var is for names of formal
parameters and such likes: names that stand for something else, not
for themselves.
> +usually points to a function in the @code{opcodes} library
> +(@xref{,,opcodes}).
Does opcodes have a manual? I cannot find it anywhere. If there is
no docs for opcodes, I think we should remove the xref.
> @var{info} is a structure defined in @code{opcodes}
> +used to pass information to the instruction decoding routine.
Maybe we should at least tell what is the name of that structure, so
that an interested reader could grep for it in opcodes' sources.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
2001-09-05 3:12 ` Eli Zaretskii
@ 2001-09-05 11:58 ` Elena Zannoni
2001-09-06 0:47 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Elena Zannoni @ 2001-09-05 11:58 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Elena Zannoni, gdb-patches
Eli Zaretskii writes:
>
> On Wed, 5 Sep 2001, Elena Zannoni wrote:
>
> > How about this?
>
> Approved, with a few minor comments (see below).
>
> Thanks!
>
> > +debugged memory abd returns the length of the instruction, in bytes. If
> ^^^
> A typo.
OK
>
> > +a target doesn't define its own printing routine, it defaults to an
> > +accessor function for the global pointer @var{tm_print_insn}.
>
> Isn't tm_print_insn a name of a real variable in GDB sources? If so,
> it should have the @code markup; @var is for names of formal
> parameters and such likes: names that stand for something else, not
> for themselves.
>
Ok, thanks.
> > +usually points to a function in the @code{opcodes} library
> > +(@xref{,,opcodes}).
>
> Does opcodes have a manual? I cannot find it anywhere. If there is
> no docs for opcodes, I think we should remove the xref.
>
There is a section about opcodes in this same document.
> > @var{info} is a structure defined in @code{opcodes}
> > +used to pass information to the instruction decoding routine.
>
> Maybe we should at least tell what is the name of that structure, so
> that an interested reader could grep for it in opcodes' sources.
True will do.
How about this:
Index: gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.35
diff -u -p -r1.35 gdbint.texinfo
--- gdbint.texinfo 2001/08/15 14:47:53 1.35
+++ gdbint.texinfo 2001/09/05 18:57:42
@@ -3566,6 +3566,18 @@ If non-zero, the target has support for
watchpoints. @xref{Algorithms, watchpoints}, for more details and
other related macros.
+@item TARGET_PRINT_INSN (@var{addr}, @var{info})
+@findex TARGET_PRINT_INSN
+This is the function used by @value{GDBN} to print an assembly
+instruction. It prints the instruction at address @var{addr} in
+debugged memory and returns the length of the instruction, in bytes. If
+a target doesn't define its own printing routine, it defaults to an
+accessor function for the global pointer @code{tm_print_insn}. This
+usually points to a function in the @code{opcodes} library (@ref{Support
+Libraries, ,Opcodes}). @var{info} is a structure (of type
+@code{disassemble_info}) defined in @file{include/dis-asm.h} used to
+pass information to the instruction decoding routine.
+
@item USE_STRUCT_CONVENTION (@var{gcc_p}, @var{type})
@findex USE_STRUCT_CONVENTION
If defined, this must be an expression that is nonzero if a value of the
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
2001-08-21 17:33 ` Andrew Cagney
@ 2001-09-05 17:07 ` Elena Zannoni
0 siblings, 0 replies; 8+ messages in thread
From: Elena Zannoni @ 2001-09-05 17:07 UTC (permalink / raw)
To: gdb-patches
Andrew Cagney writes:
> > This patch multiarches tm_print_insn.
> > I changed all the direct callers to (*tm_print_insn), to use
> > the multiarch macro TARGET_PRINT_INSN.
> >
> > If a target doesn't set the multiarch function, gdb falls back to
> > using the global, via an access function called legacy_print_insn.
>
> Er, wow, yes it works! Long ago when I first started multi-arching
> stuff I put that one in the too hard basket.
>
> Any way, ok by me.
>
I committed the code changes, will commit the doc changes when Eli
approves them.
> --
>
> Several things I noticed if you're looking for a second pass.
>
> Both chris-tdep.c and d10v-tdep.c might as well initialize the
> multi-arch field?
>
Could, yes.
> Should I add ``/tm_print_insn = /'' to the ARI?
>
Yes.
> The d10v-tdep.c, at least, has the same bug that Keith just fixed in
> printcmd.c!!
>
Ah, I'll look for that.
Elena
> Andrew
>
> > Elena
> >
> > 2001-08-01 Elena Zannoni <ezannoni@redhat.com>
> >
> > * gdbarch.sh: Move include of dis-asm.h so it is generated earlier
> > in gdbarch.h.
> > (TARGET_PRINT_INSN): Multiarch.
> > * gdbarch.h: Regenerate.
> > * gdbarch.c: Regenerate.
> >
> > * arch-utils.c (legacy_print_insn): New function.
> > * arch-utils.h (legacy_print_insn): Export.
> >
> > * cris-tdep.c (cris_delayed_get_disassembler): Use
> > TARGET_PRINT_INSN, instead of tm_print_insn.
> > * d10v-tdep.c (print_insn): Ditto.
> > * d30v-tdep.c (print_insn): Ditto.
> > * m32r-tdep.c (dump_insn): Ditto.
> > * v850-tdep.c (v850_scan_prologue): Ditto.
> > * mcore-tdep.c (mcore_dump_insn): Ditto.
> > * sh-tdep.c (sh_gdbarch_init): Set print_insn gdbarch field.
> >
> >
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
2001-09-05 11:58 ` Elena Zannoni
@ 2001-09-06 0:47 ` Eli Zaretskii
2001-09-06 5:02 ` Elena Zannoni
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2001-09-06 0:47 UTC (permalink / raw)
To: Elena Zannoni; +Cc: gdb-patches
On Wed, 5 Sep 2001, Elena Zannoni wrote:
> +usually points to a function in the @code{opcodes} library (@ref{Support
> +Libraries, ,Opcodes}).
This should be @pxref, not @ref. @ref cannot be used without some
leading text, like "described in" or "see also", and it cannot be used
in parentheses unless you put a period or a comma after the closing
brace. For that reason, for a simple cross-reference in parens,
always consider @pxref first.
Otherwise, it's fine; please commit that.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFA] Multiarch tm_print_insn
2001-09-06 0:47 ` Eli Zaretskii
@ 2001-09-06 5:02 ` Elena Zannoni
0 siblings, 0 replies; 8+ messages in thread
From: Elena Zannoni @ 2001-09-06 5:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Elena Zannoni, gdb-patches
Eli Zaretskii writes:
>
> On Wed, 5 Sep 2001, Elena Zannoni wrote:
>
> > +usually points to a function in the @code{opcodes} library (@ref{Support
> > +Libraries, ,Opcodes}).
>
> This should be @pxref, not @ref. @ref cannot be used without some
> leading text, like "described in" or "see also", and it cannot be used
> in parentheses unless you put a period or a comma after the closing
> brace. For that reason, for a simple cross-reference in parens,
> always consider @pxref first.
>
> Otherwise, it's fine; please commit that.
Ok, Thanks for the explanation.
I committed it.
Elena
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2001-09-06 5:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-21 16:26 [RFA] Multiarch tm_print_insn Elena Zannoni
2001-08-21 17:33 ` Andrew Cagney
2001-09-05 17:07 ` Elena Zannoni
[not found] ` <3405-Wed22Aug2001084554+0300-eliz@is.elta.co.il>
[not found] ` <15236.12258.330506.371048@krustylu.cygnus.com>
[not found] ` <9003-Thu23Aug2001085323+0300-eliz@is.elta.co.il>
2001-09-04 21:00 ` Elena Zannoni
2001-09-05 3:12 ` Eli Zaretskii
2001-09-05 11:58 ` Elena Zannoni
2001-09-06 0:47 ` Eli Zaretskii
2001-09-06 5:02 ` Elena Zannoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox