Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch/rfc] Eliminate deprecated_tm_print_insn
@ 2003-08-28 22:35 Andrew Cagney
  2003-09-03 23:50 ` Andrew Cagney
  2003-09-04 18:05 ` Corinna Vinschen
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-08-28 22:35 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 592 bytes --]

(and there was much rejoycing)

This patch eliminates the last remenants of the global variables:

	deprecated_tm_print_insn
	deprecated_tm_print_insn_info

Everything now goes through disasm.c.  Note that all architectures 
currently need to supply TARGET_PRINT_INSN.

There's one "future work" item - eliminate TARGET_PRINT_INSN.  GDB's 
multi-arch needs to be a way to map an address onto an arch/mach.  Once 
there opcodes/ (with some interface fudging) can be called directly and 
it can select the disassembler (well in theory).

Anyway, I'll look to commit this in a few days.

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 4564 bytes --]

2003-08-28  Andrew Cagney  <cagney@redhat.com>

	* arch-utils.h (legacy_print_insn): Delete declaration.
	* arch-utils.c (legacy_print_insn): Delete function.
	* disasm.c (deprecated_tm_print_insn_info): Delete.
	(_initialize_disasm): Delete function, contained code initializing
	deprecated_tm_print_insn_info.
	* gdbarch.sh (deprecated_tm_print_insn): Delete.
	(deprecated_tm_print_insn_info): Delete.
	(TARGET_PRINT_INSN): Do not provide a default.
	* gdbarch.h, gdbarch.c: Re-generate.

Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.91
diff -u -r1.91 arch-utils.c
--- arch-utils.c	21 Aug 2003 20:43:10 -0000	1.91
+++ arch-utils.c	28 Aug 2003 22:16:04 -0000
@@ -140,14 +140,6 @@
   return ip == SKIP_PROLOGUE (ip);
 }
 
-/* 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 (*deprecated_tm_print_insn) (vma, info);
-}
-
 /* Helper functions for INNER_THAN */
 
 int
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.53
diff -u -r1.53 arch-utils.h
--- arch-utils.h	21 Aug 2003 20:43:10 -0000	1.53
+++ arch-utils.h	28 Aug 2003 22:16:04 -0000
@@ -55,9 +55,6 @@
    language family, so that case is irrelevant for C.  */
 extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not;
 
-/* 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: disasm.c
===================================================================
RCS file: /cvs/src/src/gdb/disasm.c,v
retrieving revision 1.13
diff -u -r1.13 disasm.c
--- disasm.c	14 Aug 2003 21:39:05 -0000	1.13
+++ disasm.c	28 Aug 2003 22:16:08 -0000
@@ -384,22 +384,3 @@
   disassemble_info di = gdb_disassemble_info (current_gdbarch, stream);
   return TARGET_PRINT_INSN (memaddr, &di);
 }
-
-\f
-/* FIXME: cagney/2003-04-28: This global deprecated_tm_print_insn_info
-   is going away.  */
-disassemble_info deprecated_tm_print_insn_info;
-
-extern void _initialize_disasm (void);
-
-void
-_initialize_disasm (void)
-{
-  
-  INIT_DISASSEMBLE_INFO_NO_ARCH (deprecated_tm_print_insn_info, gdb_stdout,
-				 (fprintf_ftype)fprintf_filtered);
-  deprecated_tm_print_insn_info.flavour = bfd_target_unknown_flavour;
-  deprecated_tm_print_insn_info.read_memory_func = dis_asm_read_memory;
-  deprecated_tm_print_insn_info.memory_error_func = dis_asm_memory_error;
-  deprecated_tm_print_insn_info.print_address_func = dis_asm_print_address;
-}
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.263
diff -u -r1.263 gdbarch.sh
--- gdbarch.sh	18 Aug 2003 20:04:55 -0000	1.263
+++ gdbarch.sh	28 Aug 2003 22:16:52 -0000
@@ -672,7 +672,9 @@
 # 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
-f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0
+# FIXME: cagney/2003-08-28: Need to find a better way of selecting the
+# disassembler.  Perhaphs objdump can handle it?
+f::TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::0:
 f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
 
 
@@ -1205,14 +1207,6 @@
 #endif
 
 
-/* The target-system-dependent disassembler is semi-dynamic */
-
-/* Use gdb_disassemble, and gdbarch_print_insn instead.  */
-extern int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info*);
-
-/* Use set_gdbarch_print_insn instead.  */
-extern disassemble_info deprecated_tm_print_insn_info;
-
 /* Set the dynamic target-system-dependent parameters (architecture,
    byte-order, ...) using information found in the BFD */
 
@@ -2300,11 +2294,6 @@
   return 1;
 }
 
-
-/* Disassembler */
-
-/* Pointer to the target-dependent disassembly function.  */
-int (*deprecated_tm_print_insn) (bfd_vma, disassemble_info *);
 
 extern void _initialize_gdbarch (void);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate deprecated_tm_print_insn
  2003-08-28 22:35 [patch/rfc] Eliminate deprecated_tm_print_insn Andrew Cagney
@ 2003-09-03 23:50 ` Andrew Cagney
  2003-09-04 18:05 ` Corinna Vinschen
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-09-03 23:50 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

> 2003-08-28  Andrew Cagney  <cagney@redhat.com>
> 
> 	* arch-utils.h (legacy_print_insn): Delete declaration.
> 	* arch-utils.c (legacy_print_insn): Delete function.
> 	* disasm.c (deprecated_tm_print_insn_info): Delete.
> 	(_initialize_disasm): Delete function, contained code initializing
> 	deprecated_tm_print_insn_info.
> 	* gdbarch.sh (deprecated_tm_print_insn): Delete.
> 	(deprecated_tm_print_insn_info): Delete.
> 	(TARGET_PRINT_INSN): Do not provide a default.
> 	* gdbarch.h, gdbarch.c: Re-generate.

I'm just now checking this in ...

Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate deprecated_tm_print_insn
  2003-08-28 22:35 [patch/rfc] Eliminate deprecated_tm_print_insn Andrew Cagney
  2003-09-03 23:50 ` Andrew Cagney
@ 2003-09-04 18:05 ` Corinna Vinschen
  2003-09-04 18:17   ` Andrew Cagney
  1 sibling, 1 reply; 5+ messages in thread
From: Corinna Vinschen @ 2003-09-04 18:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Cagney

On Thu, Aug 28, 2003 at 06:35:43PM -0400, Andrew Cagney wrote:
> 2003-08-28  Andrew Cagney  <cagney@redhat.com>
> 
> 	* arch-utils.h (legacy_print_insn): Delete declaration.
> 	* arch-utils.c (legacy_print_insn): Delete function.
> 	* disasm.c (deprecated_tm_print_insn_info): Delete.
> 	(_initialize_disasm): Delete function, contained code initializing
> 	deprecated_tm_print_insn_info.
> 	* gdbarch.sh (deprecated_tm_print_insn): Delete.
> 	(deprecated_tm_print_insn_info): Delete.
> 	(TARGET_PRINT_INSN): Do not provide a default.
> 	* gdbarch.h, gdbarch.c: Re-generate.

After this change I'm getting an error when building:

gcc -g       \
        -o gdb gdb.o main.o cli-dump.o cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o cli-logging.o cli-interp.o mi-out.o mi-console.o mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o libgdb.a \
	          ../sim/sh/libsim.a ../bfd/libbfd.a ../readline/libreadline.a ../opcodes/libopcodes.a  ../libiberty/libiberty.a     -lncurses -lm   ../libiberty/libiberty.a  -ldl -rdynamic
libgdb.a(disasm.o): In function `gdb_disassemble_info':
/home/corinna/src/gdb/src/gdb/disasm.c:331: undefined reference to `init_disassemble_info'
collect2: ld returned 1 exit status
make: *** [gdb] Error 1


Grepping for init_disassemble_info in all sources just reveals the call
to init_disassemble_info in disasm.c.  Where's the function?

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate deprecated_tm_print_insn
  2003-09-04 18:05 ` Corinna Vinschen
@ 2003-09-04 18:17   ` Andrew Cagney
  2003-09-04 19:27     ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2003-09-04 18:17 UTC (permalink / raw)
  To: Corinna Vinschen; +Cc: gdb-patches

> On Thu, Aug 28, 2003 at 06:35:43PM -0400, Andrew Cagney wrote:
> 
>> 2003-08-28  Andrew Cagney  <cagney@redhat.com>
>> 
>> 	* arch-utils.h (legacy_print_insn): Delete declaration.
>> 	* arch-utils.c (legacy_print_insn): Delete function.
>> 	* disasm.c (deprecated_tm_print_insn_info): Delete.
>> 	(_initialize_disasm): Delete function, contained code initializing
>> 	deprecated_tm_print_insn_info.
>> 	* gdbarch.sh (deprecated_tm_print_insn): Delete.
>> 	(deprecated_tm_print_insn_info): Delete.
>> 	(TARGET_PRINT_INSN): Do not provide a default.
>> 	* gdbarch.h, gdbarch.c: Re-generate.
> 
> 
> After this change I'm getting an error when building:
> 
> gcc -g       \
>         -o gdb gdb.o main.o cli-dump.o cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-utils.o cli-logging.o cli-interp.o mi-out.o mi-console.o mi-cmds.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o libgdb.a \
> 	          
Check that your opcodes directory is up-to-date.  In particular it 
contains dis-init.o.

Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch/rfc] Eliminate deprecated_tm_print_insn
  2003-09-04 18:17   ` Andrew Cagney
@ 2003-09-04 19:27     ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-09-04 19:27 UTC (permalink / raw)
  To: gdb-patches

On Thu, Sep 04, 2003 at 02:17:37PM -0400, Andrew Cagney wrote:
> >On Thu, Aug 28, 2003 at 06:35:43PM -0400, Andrew Cagney wrote:
> >
> >>2003-08-28  Andrew Cagney  <cagney@redhat.com>
> >>
> >>	* arch-utils.h (legacy_print_insn): Delete declaration.
> >>	* arch-utils.c (legacy_print_insn): Delete function.
> >>	* disasm.c (deprecated_tm_print_insn_info): Delete.
> >>	(_initialize_disasm): Delete function, contained code initializing
> >>	deprecated_tm_print_insn_info.
> >>	* gdbarch.sh (deprecated_tm_print_insn): Delete.
> >>	(deprecated_tm_print_insn_info): Delete.
> >>	(TARGET_PRINT_INSN): Do not provide a default.
> >>	* gdbarch.h, gdbarch.c: Re-generate.
> >
> >
> >After this change I'm getting an error when building:
> >
> >gcc -g       \
> >        -o gdb gdb.o main.o cli-dump.o cli-decode.o cli-script.o 
> >        cli-cmds.o cli-setshow.o cli-utils.o cli-logging.o cli-interp.o 
> >        mi-out.o mi-console.o mi-cmds.o mi-cmd-env.o mi-cmd-var.o 
> >        mi-cmd-break.o mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o 
> >        mi-symbol-cmds.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o 
> >        libgdb.a \
> >	          
> Check that your opcodes directory is up-to-date.  In particular it 
> contains dis-init.o.

Uh, thanks, that did it.

Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-04 19:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-28 22:35 [patch/rfc] Eliminate deprecated_tm_print_insn Andrew Cagney
2003-09-03 23:50 ` Andrew Cagney
2003-09-04 18:05 ` Corinna Vinschen
2003-09-04 18:17   ` Andrew Cagney
2003-09-04 19:27     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox