This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[commit] Hack around disasm build problem
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: insight at sources dot redhat dot com
- Date: Mon, 08 Sep 2003 15:32:13 -0400
- Subject: [commit] Hack around disasm build problem
Hello,
This patches things up sufficient to get insight building again. Note
though that it doesn't fix the underlying problem - that code needs to
be converted (largely deleted) to gdb_disassemble().
Note that it also deletes the bogus performance tweak of disassembling
from the executable instead of the target. "gdb/disasm.c" contains the
details of why this is wrong.
committed,
Andrew
2003-09-08 Andrew Cagney <cagney@redhat.com>
* generic/gdbtk-cmds.c: Include "disasm.h".
(gdbtk_load_asm): Use "gdb_print_insn" instead of
TARGET_PRINT_INSN .
(gdb_disassemble_driver): Delete code referencing
"deprecated_tm_print_insn_info". Delete "di" and "di_initialized"
and any code initializing those variables. Pass NULL as "di"
parameter to "print_asm_fn".
(disassemble_from_exec): Mention that it is unused.
Index: generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.76
diff -u -r1.76 gdbtk-cmds.c
--- generic/gdbtk-cmds.c 27 Jun 2003 00:29:16 -0000 1.76
+++ generic/gdbtk-cmds.c 8 Sep 2003 19:26:00 -0000
@@ -37,6 +37,7 @@
#include "block.h"
#include "dictionary.h"
#include "filenames.h"
+#include "disasm.h"
/* tcl header files includes varargs.h unless HAS_STDARG is defined,
but gdb uses stdarg.h, so make sure HAS_STDARG is defined. */
@@ -112,9 +113,9 @@
Tcl_CmdInfo cmd;
};
-/* This variable determines where memory used for disassembly is read from.
- * See note in gdbtk.h for details.
- */
+/* This variable determines where memory used for disassembly is read
+ from. See note in gdbtk.h for details. */
+/* NOTE: cagney/2003-09-08: This variable is unused. */
int disassemble_from_exec = -1;
extern int gdb_variable_init (Tcl_Interp * interp);
@@ -1847,6 +1848,7 @@
}
+/* FIXME: cagney/2003-09-08: "di" is not used and unneeded. */
static CORE_ADDR
gdbtk_load_asm (ClientData clientData, CORE_ADDR pc,
struct disassemble_info *di)
@@ -1885,7 +1887,8 @@
gdb_flush (gdb_stdout);
result_ptr->obj_ptr = client_data->result_obj[2];
- insn = TARGET_PRINT_INSN (pc, di);
+ /* FIXME: cagney/2003-09-08: This should use gdb_disassembly. */
+ insn = gdb_print_insn (pc, gdb_stdout);
gdb_flush (gdb_stdout);
client_data->widget_line_no++;
@@ -1943,67 +1946,6 @@
CORE_ADDR (*print_asm_fn) (ClientData, CORE_ADDR, struct disassemble_info *))
{
CORE_ADDR pc;
- static disassemble_info di;
- static int di_initialized;
-
- if (! di_initialized)
- {
- INIT_DISASSEMBLE_INFO_NO_ARCH (di, gdb_stdout,
- (fprintf_ftype) fprintf_unfiltered);
- di.flavour = bfd_target_unknown_flavour;
- /* NOTE: cagney/2003-04: This all goes away, along with this
- function, when insight starts using the "disasm.h"
- disassembler. */
- di.memory_error_func = deprecated_tm_print_insn_info.memory_error_func;
- di.print_address_func = deprecated_tm_print_insn_info.print_address_func;
- di_initialized = 1;
- }
-
- di.mach = deprecated_tm_print_insn_info.mach;
- if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
- di.endian = BFD_ENDIAN_BIG;
- else
- di.endian = BFD_ENDIAN_LITTLE;
-
- /* Set the architecture for multi-arch configurations. */
- if (TARGET_ARCHITECTURE != NULL)
- di.mach = TARGET_ARCHITECTURE->mach;
-
- /* If disassemble_from_exec == -1, then we use the following heuristic to
- determine whether or not to do disassembly from target memory or from the
- exec file:
-
- If we're debugging a local process, read target memory, instead of the
- exec file. This makes disassembly of functions in shared libs work
- correctly. Also, read target memory if we are debugging native threads.
-
- Else, we're debugging a remote process, and should disassemble from the
- exec file for speed. However, this is no good if the target modifies its
- code (for relocation, or whatever).
-
- As an aside, it is fairly bogus that there is not a better way to
- determine where to disassemble from. There should be a target vector
- entry for this or something.
-
- */
-
- if (disassemble_from_exec == -1)
- {
- if (strcmp (target_shortname, "child") == 0
- || strcmp (target_shortname, "procfs") == 0
- || strcmp (target_shortname, "vxprocess") == 0
- || strstr (target_shortname, "thread") != NULL)
- /* It's a child process, read inferior mem */
- disassemble_from_exec = 0;
- else
- /* It's remote, read the exec file */
- disassemble_from_exec = 1;
- }
-
- if (disassemble_from_exec)
- di.read_memory_func = gdbtk_dis_asm_read_memory;
- else
- di.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
/* If just doing straight assembly, all we need to do is disassemble
everything between low and high. If doing mixed source/assembly, we've
@@ -2112,7 +2054,9 @@
for (pc = mle[i].start_pc; pc < mle[i].end_pc; )
{
QUIT;
- pc = print_asm_fn (clientData, pc, &di);
+ /* FIXME: cagney/2003-09-08: This entire function should
+ be replaced by gdb_disassembly. */
+ pc = print_asm_fn (clientData, pc, NULL);
}
}
}
@@ -2122,7 +2066,9 @@
for (pc = low; pc < high; )
{
QUIT;
- pc = print_asm_fn (clientData, pc, &di);
+ /* FIXME: cagney/2003-09-08: This entire function should be
+ replaced by gdb_disassembly. */
+ pc = print_asm_fn (clientData, pc, NULL);
}
}