aboutsummaryrefslogtreecommitdiff
path: root/gdb/disasm.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2003-02-03 01:18:37 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2003-02-03 01:18:37 +0000
commit3b31d625f3b05256b22c245c144e7e228e20f079 (patch)
tree7ef7e2358a674252f8bbf5fa71ab1e031837d057 /gdb/disasm.c
parent70a296bc46ba0532f6160caf76355c7e601a1060 (diff)
downloadgdb-3b31d625f3b05256b22c245c144e7e228e20f079.zip
gdb-3b31d625f3b05256b22c245c144e7e228e20f079.tar.gz
gdb-3b31d625f3b05256b22c245c144e7e228e20f079.tar.bz2
2003-02-02 Elena Zannoni <ezannoni@redhat.com>
Fix PR gdb/742 gdb/743 * disasm.c (dump_insns): Use make_cleanup_ui_out_tuple_begin_end. (do_mixed_source_and_assembly): Use make_cleanup_ui_out_tuple_begin_end and make_cleanup_ui_out_tuple_begin_end. (do_mixed_source_and_assembly): Ditto. * thread.c (do_captured_list_thread_ids): Ditto. * ui-out.h (ui_out_table_begin, ui_out_list_begin, ui_out_tuple_begin, ui_out_table_end, ui_out_list_end, ui_out_tuple_end): Delete prototypes. * ui-out.c (ui_out_list_begin, ui_out_tuple_begin, ui_out_list_end, ui_out_tuple_end): Delete. From Kevin Buettner <kevinb@redhat.com>: * ui-out.h (make_cleanup_ui_out_table_begin_end): New function. * ui-out.c (make_cleanup_ui_out_table_begin_end) (do_cleanup_table_end): New functions. * breakpoint.c (print_it_typical, print_one_breakpoint, mention): Use cleanups to invoke_ui_out_tuple_end(). (breakpoint_1): Use cleanup to invoke ui_out_table_end(). * cli/cli-setshow.c (cmd_show_list): Use make_cleanup_ui_out_tuple_begin_end.
Diffstat (limited to 'gdb/disasm.c')
-rw-r--r--gdb/disasm.c51
1 files changed, 35 insertions, 16 deletions
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 4ac22a2..75d1783 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -97,6 +97,7 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
char *name = NULL;
int offset;
int line;
+ struct cleanup *ui_out_chain;
for (pc = low; pc < high;)
{
@@ -108,7 +109,7 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
else
num_displayed++;
}
- ui_out_tuple_begin (uiout, NULL);
+ ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_core_addr (uiout, "address", pc);
if (!build_address_symbolic (pc, 0, &name, &offset, &filename,
@@ -131,7 +132,7 @@ dump_insns (struct ui_out *uiout, disassemble_info * di,
pc += TARGET_PRINT_INSN (pc, di);
ui_out_field_stream (uiout, "inst", stb);
ui_file_rewind (stb->stream);
- ui_out_tuple_end (uiout);
+ do_cleanups (ui_out_chain);
ui_out_text (uiout, "\n");
}
return num_displayed;
@@ -157,6 +158,7 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
int next_line = 0;
CORE_ADDR pc;
int num_displayed = 0;
+ struct cleanup *ui_out_chain;
mle = (struct dis_line_entry *) alloca (nlines
* sizeof (struct dis_line_entry));
@@ -210,11 +212,14 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
they have been emitted before), followed by the assembly code
for that line. */
- ui_out_list_begin (uiout, "asm_insns");
+ ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
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)
{
@@ -223,7 +228,9 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
/* Just one line to print. */
if (next_line == mle[i].line)
{
- ui_out_tuple_begin (uiout, "src_and_asm_line");
+ ui_out_tuple_chain
+ = make_cleanup_ui_out_tuple_begin_end (uiout,
+ "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
}
else
@@ -231,27 +238,38 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
/* Several source lines w/o asm instructions associated. */
for (; next_line < mle[i].line; next_line++)
{
- ui_out_tuple_begin (uiout, "src_and_asm_line");
+ struct cleanup *ui_out_list_chain_line;
+ struct cleanup *ui_out_tuple_chain_line;
+
+ ui_out_tuple_chain_line
+ = make_cleanup_ui_out_tuple_begin_end (uiout,
+ "src_and_asm_line");
print_source_lines (symtab, next_line, next_line + 1,
0);
- ui_out_list_begin (uiout, "line_asm_insn");
- ui_out_list_end (uiout);
- ui_out_tuple_end (uiout);
+ ui_out_list_chain_line
+ = make_cleanup_ui_out_list_begin_end (uiout,
+ "line_asm_insn");
+ do_cleanups (ui_out_list_chain_line);
+ do_cleanups (ui_out_tuple_chain_line);
}
/* Print the last line and leave list open for
asm instructions to be added. */
- ui_out_tuple_begin (uiout, "src_and_asm_line");
+ ui_out_tuple_chain
+ = make_cleanup_ui_out_tuple_begin_end (uiout,
+ "src_and_asm_line");
print_source_lines (symtab, next_line, mle[i].line + 1, 0);
}
}
else
{
- ui_out_tuple_begin (uiout, "src_and_asm_line");
+ ui_out_tuple_chain
+ = make_cleanup_ui_out_tuple_begin_end (uiout, "src_and_asm_line");
print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0);
}
next_line = mle[i].line + 1;
- ui_out_list_begin (uiout, "line_asm_insn");
+ 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;
@@ -261,8 +279,8 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
how_many, stb);
if (close_list)
{
- ui_out_list_end (uiout);
- ui_out_tuple_end (uiout);
+ do_cleanups (ui_out_list_chain);
+ do_cleanups (ui_out_tuple_chain);
ui_out_text (uiout, "\n");
close_list = 0;
}
@@ -270,7 +288,7 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
if (num_displayed >= how_many)
break;
}
- ui_out_list_end (uiout);
+ do_cleanups (ui_out_chain);
}
@@ -280,12 +298,13 @@ do_assembly_only (struct ui_out *uiout, disassemble_info * di,
int how_many, struct ui_stream *stb)
{
int num_displayed = 0;
+ struct cleanup *ui_out_chain;
- ui_out_list_begin (uiout, "asm_insns");
+ ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
num_displayed = dump_insns (uiout, di, low, high, how_many, stb);
- ui_out_list_end (uiout);
+ do_cleanups (ui_out_chain);
}
void