projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2005-05-22 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git]
/
gdb
/
disasm.c
diff --git
a/gdb/disasm.c
b/gdb/disasm.c
index 0dfd20aaa178a3dbcd0a3a0dede44cca534c7426..4126f7262212c5c6e6e57f4dcfc8893453a76741 100644
(file)
--- a/
gdb/disasm.c
+++ b/
gdb/disasm.c
@@
-1,6
+1,6
@@
/* Disassemble support for GDB.
/* Disassemble support for GDB.
- Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003
, 2004
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-26,6
+26,7
@@
#include "gdb_string.h"
#include "disasm.h"
#include "gdbcore.h"
#include "gdb_string.h"
#include "disasm.h"
#include "gdbcore.h"
+#include "dis-asm.h"
/* Disassemble functions.
FIXME: We should get rid of all the duplicate code in gdb that does
/* Disassemble functions.
FIXME: We should get rid of all the duplicate code in gdb that does
@@
-45,15
+46,16
@@
struct dis_line_entry
/* Like target_read_memory, but slightly different parameters. */
static int
/* Like target_read_memory, but slightly different parameters. */
static int
-dis_asm_read_memory (bfd_vma memaddr,
bfd
_byte *myaddr, unsigned int len,
- disassemble_info *info)
+dis_asm_read_memory (bfd_vma memaddr,
gdb
_byte *myaddr, unsigned int len,
+
struct
disassemble_info *info)
{
{
- return target_read_memory (memaddr,
(char *)
myaddr, len);
+ return target_read_memory (memaddr, myaddr, len);
}
/* Like memory_error with slightly different parameters. */
static void
}
/* Like memory_error with slightly different parameters. */
static void
-dis_asm_memory_error (int status, bfd_vma memaddr, disassemble_info *info)
+dis_asm_memory_error (int status, bfd_vma memaddr,
+ struct disassemble_info *info)
{
memory_error (status, memaddr);
}
{
memory_error (status, memaddr);
}
@@
-83,7
+85,7
@@
compare_lines (const void *mle1p, const void *mle2p)
}
static int
}
static int
-dump_insns (struct ui_out *uiout, disassemble_info * di,
+dump_insns (struct ui_out *uiout,
struct
disassemble_info * di,
CORE_ADDR low, CORE_ADDR high,
int how_many, struct ui_stream *stb)
{
CORE_ADDR low, CORE_ADDR high,
int how_many, struct ui_stream *stb)
{
@@
-162,6
+164,8
@@
do_mixed_source_and_assembly (struct ui_out *uiout,
CORE_ADDR pc;
int num_displayed = 0;
struct cleanup *ui_out_chain;
CORE_ADDR pc;
int num_displayed = 0;
struct cleanup *ui_out_chain;
+ struct cleanup *ui_out_tuple_chain = make_cleanup (null_cleanup, 0);
+ struct cleanup *ui_out_list_chain = make_cleanup (null_cleanup, 0);
mle = (struct dis_line_entry *) alloca (nlines
* sizeof (struct dis_line_entry));
mle = (struct dis_line_entry *) alloca (nlines
* sizeof (struct dis_line_entry));
@@
-219,10
+223,6
@@
do_mixed_source_and_assembly (struct ui_out *uiout,
for (i = 0; i < newlines; i++)
{
for (i = 0; i < newlines; i++)
{
- struct cleanup *ui_out_tuple_chain = NULL;
- struct cleanup *ui_out_list_chain = NULL;
- int close_list = 1;
-
/* Print out everything from next_line to the current line. */
if (mle[i].line >= next_line)
{
/* Print out everything from next_line to the current line. */
if (mle[i].line >= next_line)
{
@@
-273,30
+273,30
@@
do_mixed_source_and_assembly (struct ui_out *uiout,
next_line = mle[i].line + 1;
ui_out_list_chain
= make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn");
next_line = mle[i].line + 1;
ui_out_list_chain
= make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn");
- /* Don't close the list if the lines are not in order. */
- if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line)
- close_list = 0;
}
num_displayed += dump_insns (uiout, di, mle[i].start_pc, mle[i].end_pc,
how_many, stb);
}
num_displayed += dump_insns (uiout, di, mle[i].start_pc, mle[i].end_pc,
how_many, stb);
- if (close_list)
+
+ /* When we've reached the end of the mle array, or we've seen the last
+ assembly range for this source line, close out the list/tuple. */
+ if (i == (newlines - 1) || mle[i + 1].line > mle[i].line)
{
do_cleanups (ui_out_list_chain);
do_cleanups (ui_out_tuple_chain);
{
do_cleanups (ui_out_list_chain);
do_cleanups (ui_out_tuple_chain);
+ ui_out_tuple_chain = make_cleanup (null_cleanup, 0);
+ ui_out_list_chain = make_cleanup (null_cleanup, 0);
ui_out_text (uiout, "\n");
ui_out_text (uiout, "\n");
- close_list = 0;
}
}
- if (how_many >= 0)
- if (num_displayed >= how_many)
- break;
+ if (how_many >= 0 && num_displayed >= how_many)
+ break;
}
do_cleanups (ui_out_chain);
}
static void
}
do_cleanups (ui_out_chain);
}
static void
-do_assembly_only (struct ui_out *uiout, disassemble_info * di,
+do_assembly_only (struct ui_out *uiout,
struct
disassemble_info * di,
CORE_ADDR low, CORE_ADDR high,
int how_many, struct ui_stream *stb)
{
CORE_ADDR low, CORE_ADDR high,
int how_many, struct ui_stream *stb)
{
@@
-324,10
+324,10
@@
fprintf_disasm (void *stream, const char *format, ...)
return 0;
}
return 0;
}
-static disassemble_info
+static
struct
disassemble_info
gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
{
gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
{
- disassemble_info di;
+
struct
disassemble_info di;
init_disassemble_info (&di, file, fprintf_disasm);
di.flavour = bfd_target_unknown_flavour;
di.memory_error_func = dis_asm_memory_error;
init_disassemble_info (&di, file, fprintf_disasm);
di.flavour = bfd_target_unknown_flavour;
di.memory_error_func = dis_asm_memory_error;
@@
-335,7
+335,7
@@
gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
/* NOTE: cagney/2003-04-28: The original code, from the old Insight
disassembler had a local optomization here. By default it would
access the executable file, instead of the target memory (there
/* NOTE: cagney/2003-04-28: The original code, from the old Insight
disassembler had a local optomization here. By default it would
access the executable file, instead of the target memory (there
- was a growing list of exceptions though). Unfortunatly, the
+ was a growing list of exceptions though). Unfortunat
e
ly, the
heuristic was flawed. Commands like "disassemble &variable"
didn't work as they relied on the access going to the target.
Further, it has been supperseeded by trust-read-only-sections
heuristic was flawed. Commands like "disassemble &variable"
didn't work as they relied on the access going to the target.
Further, it has been supperseeded by trust-read-only-sections
@@
-344,6
+344,7
@@
gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file)
di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
di.endian = gdbarch_byte_order (gdbarch);
di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
di.endian = gdbarch_byte_order (gdbarch);
+ disassemble_init_for_target (&di);
return di;
}
return di;
}
@@
-356,7
+357,7
@@
gdb_disassembly (struct ui_out *uiout,
{
struct ui_stream *stb = ui_out_stream_new (uiout);
struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb);
{
struct ui_stream *stb = ui_out_stream_new (uiout);
struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb);
- disassemble_info di = gdb_disassemble_info (current_gdbarch, stb->stream);
+
struct
disassemble_info di = gdb_disassemble_info (current_gdbarch, stb->stream);
/* To collect the instruction outputted from opcodes. */
struct symtab *symtab = NULL;
struct linetable_entry *le = NULL;
/* To collect the instruction outputted from opcodes. */
struct symtab *symtab = NULL;
struct linetable_entry *le = NULL;
@@
-390,6
+391,6
@@
gdb_disassembly (struct ui_out *uiout,
int
gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream)
{
int
gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream)
{
- disassemble_info di = gdb_disassemble_info (current_gdbarch, stream);
+
struct
disassemble_info di = gdb_disassemble_info (current_gdbarch, stream);
return TARGET_PRINT_INSN (memaddr, &di);
}
return TARGET_PRINT_INSN (memaddr, &di);
}
This page took
0.02639 seconds
and
4
git commands to generate.