/* Disassemble support for GDB.
- Copyright (C) 2000-2019 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
This file is part of GDB.
if (mle1.start_pc != mle2.start_pc)
val = mle1.start_pc < mle2.start_pc;
else
- val = mle1.line < mle2.line;
+ val = mle1.line < mle2.line;
}
else
{
if (mle1.line != mle2.line)
val = mle1.line < mle2.line;
else
- val = mle1.start_pc < mle2.start_pc;
+ val = mle1.start_pc < mle2.start_pc;
}
return val;
}
std::string name, filename;
bool omit_fname = ((flags & DISASSEMBLY_OMIT_FNAME) != 0);
if (!build_address_symbolic (gdbarch, pc, false, omit_fname, &name,
- &offset, &filename, &line, &unmapped))
+ &offset, &filename, &line, &unmapped))
{
/* We don't care now about line, filename and unmapped. But we might in
the future. */
m_uiout->text (" <");
if (!omit_fname)
- m_uiout->field_string ("func-name", name.c_str (),
+ m_uiout->field_string ("func-name", name,
function_name_style.style ());
/* For negative offsets, avoid displaying them as +-N; the sign of
the offset takes the place of the "+" here. */
how_many, flags, NULL);
/* 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. */
+ assembly range for this source line, close out the list/tuple. */
if (i == (newlines - 1) || mle[i + 1].line > mle[i].line)
{
inner_list_emitter.reset ();
disassemble_init_for_target (&m_di);
}
+gdb_disassembler::~gdb_disassembler ()
+{
+ disassemble_free_target (&m_di);
+}
+
int
gdb_disassembler::print_insn (CORE_ADDR memaddr,
int *branch_delay_insns)
gdb_buffered_insn_length_init_dis (gdbarch, &di, insn, max_len, addr,
&disassembler_options_holder);
- return gdbarch_print_insn (gdbarch, addr, &di);
+ int result = gdbarch_print_insn (gdbarch, addr, &di);
+ disassemble_free_target (&di);
+ return result;
}
char *
/* Initialization code. */
+void _initialize_disasm ();
void
-_initialize_disasm (void)
+_initialize_disasm ()
{
- struct cmd_list_element *cmd;
-
/* Add the command that controls the disassembler options. */
- cmd = add_setshow_string_noescape_cmd ("disassembler-options", no_class,
- &prospective_options, _("\
+ set_show_commands set_show_disas_opts
+ = add_setshow_string_noescape_cmd ("disassembler-options", no_class,
+ &prospective_options, _("\
Set the disassembler options.\n\
Usage: set disassembler-options OPTION [,OPTION]...\n\n\
See: 'show disassembler-options' for valid option values."), _("\
set_disassembler_options_sfunc,
show_disassembler_options_sfunc,
&setlist, &showlist);
- set_cmd_completer (cmd, disassembler_options_completer);
+ set_cmd_completer (set_show_disas_opts.set, disassembler_options_completer);
}