GDB (xrefs)

Classes | Functions | Variables
/tmp/gdb-8.1/gdb/disasm.c File Reference
`#include "defs.h"`
`#include "arch-utils.h"`
`#include "target.h"`
`#include "value.h"`
`#include "ui-out.h"`
`#include "disasm.h"`
`#include "gdbcore.h"`
`#include "gdbcmd.h"`
`#include "dis-asm.h"`
`#include "source.h"`
`#include "safe-ctype.h"`
`#include <algorithm>`
`#include "common/gdb_optional.h"`

Go to the source code of this file.

## Classes
struct | deprecated_dis_line_entry
struct | dis_line_entry

## Functions
static hashval_t | hash_dis_line_entry (const void *item)
static int | eq_dis_line_entry (const void *item_lhs, const void *item_rhs)
static htab_t | allocate_dis_line_table (void)
static void | add_dis_line_entry (htab_t table, struct symtab *symtab, int line)
static int | line_has_code_p (htab_t table, struct symtab *symtab, int line)
static int | compare_lines (const void *mle1p, const void *mle2p)
static int | dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, CORE_ADDR low, CORE_ADDR high, int how_many, gdb_disassembly_flags flags, CORE_ADDR *end_pc)
static void | do_mixed_source_and_assembly_deprecated (struct gdbarch *gdbarch, struct ui_out *uiout, struct symtab *symtab, CORE_ADDR low, CORE_ADDR high, int how_many, gdb_disassembly_flags flags)
static void | do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout, struct symtab *main_symtab, CORE_ADDR low, CORE_ADDR high, int how_many, gdb_disassembly_flags flags)
static void | do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, CORE_ADDR low, CORE_ADDR high, int how_many, gdb_disassembly_flags flags)
static int | ATTRIBUTE_PRINTF (2, 3)
void | gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout, gdb_disassembly_flags flags, int how_many, CORE_ADDR low, CORE_ADDR high)
int | gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr, struct ui_file *stream, int *branch_delay_insns)
int | gdb_insn_length (struct gdbarch *gdbarch, CORE_ADDR addr)
static void | gdb_buffered_insn_length_init_dis (struct gdbarch *gdbarch, struct disassemble_info *di, const gdb_byte *insn, int max_len, CORE_ADDR addr)
int | gdb_buffered_insn_length (struct gdbarch *gdbarch, const gdb_byte *insn, int max_len, CORE_ADDR addr)
char * | get_disassembler_options (struct gdbarch *gdbarch)
void | set_disassembler_options (char *prospective_options)
static void | set_disassembler_options_sfunc (const char *args, int from_tty, struct cmd_list_element *c)
static void | show_disassembler_options_sfunc (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void | disassembler_options_completer (struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
void | _initialize_disasm (void)

## Variables
static char * | prospective_options = NULL

## Function Documentation

## ◆ _initialize_disasm()

void _initialize_disasm | ( | void |  | ) |

Definition at line 1031 of file disasm.c.

References _, add_setshow_string_noescape_cmd(), disassembler_options_completer(), no_class, prospective_options, set_cmd_completer(), set_disassembler_options_sfunc(), setlist, show_disassembler_options_sfunc(), and showlist.

## ◆ add_dis_line_entry()

static void add_dis_line_entry | ( | htab_t | table,
|  | struct symtab * | symtab,
|  | int | line
| ) |  |
| static

Definition at line 101 of file disasm.c.

References dis_line_entry::line, dis_line_entry::symtab, and XNEW.

Referenced by do_mixed_source_and_assembly().

## ◆ allocate_dis_line_table()

static htab_t allocate_dis_line_table | ( | void |  | ) |
| static

Definition at line 91 of file disasm.c.

References eq_dis_line_entry(), hash_dis_line_entry(), xcalloc(), and xfree().

Referenced by do_mixed_source_and_assembly().

## ◆ ATTRIBUTE_PRINTF()

static int ATTRIBUTE_PRINTF | ( | 2 | ,
|  | 3 |
| ) |  |
| static

Definition at line 718 of file disasm.c.

References vfprintf_filtered().

## ◆ compare_lines()

static int compare_lines | ( | const void * | mle1p,
|  | const void * | mle2p
| ) |  |
| static

Definition at line 165 of file disasm.c.

References deprecated_dis_line_entry::line, and deprecated_dis_line_entry::start_pc.

Referenced by do_mixed_source_and_assembly_deprecated().

## ◆ disassembler_options_completer()

static void disassembler_options_completer | ( | struct cmd_list_element * | ignore,
|  | completion_tracker & | tracker,
|  | const char * | text,
|  | const char * | word
| ) |  |
| static

Definition at line 1009 of file disasm.c.

References complete_on_enum(), gdbarch_valid_disassembler_options(), get_current_arch(), and skip_spaces().

Referenced by _initialize_disasm().

## ◆ do_assembly_only()

static void do_assembly_only | ( | struct gdbarch * | gdbarch,
|  | struct ui_out * | uiout,
|  | CORE_ADDR | low,
|  | CORE_ADDR | high,
|  | int | how_many,
|  | gdb_disassembly_flags | flags
| ) |  |
| static

Definition at line 706 of file disasm.c.

References dump_insns(), and flags.

Referenced by gdb_disassembly().

## ◆ do_mixed_source_and_assembly()

static void do_mixed_source_and_assembly | ( | struct gdbarch * | gdbarch,
|  | struct ui_out * | uiout,
|  | struct symtab * | main_symtab,
|  | CORE_ADDR | low,
|  | CORE_ADDR | high,
|  | int | how_many,
|  | gdb_disassembly_flags | flags
| ) |  |
| static

Definition at line 483 of file disasm.c.

References _, add_dis_line_entry(), allocate_dis_line_table(), DISASSEMBLY_FILENAME, dump_insns(), gdb::optional< T >::emplace(), symtab_and_line::end, find_pc_line(), flags, gdb_assert, gdb_insn_length(), gdb::optional< T >::has_value(), linetable_entry::line, symtab_and_line::line, line_has_code_p(), symtab::nlines, linetable_entry::pc, symtab_and_line::pc, print_source_lines(), PRINT_SOURCE_LINES_FILENAME, gdb::optional< T >::reset(), symtab_and_line::symtab, SYMTAB_LINETABLE, symtab_to_filename_for_display(), and ui_out::text().

Referenced by gdb_disassembly().

## ◆ do_mixed_source_and_assembly_deprecated()

static void do_mixed_source_and_assembly_deprecated | ( | struct gdbarch * | gdbarch,
|  | struct ui_out * | uiout,
|  | struct symtab * | symtab,
|  | CORE_ADDR | low,
|  | CORE_ADDR | high,
|  | int | how_many,
|  | gdb_disassembly_flags | flags
| ) |  |
| static

Definition at line 338 of file disasm.c.

References compare_lines(), DISASSEMBLY_FILENAME, dump_insns(), gdb::optional< T >::emplace(), symtab_and_line::end, deprecated_dis_line_entry::end_pc, find_pc_line(), flags, gdb_assert, deprecated_dis_line_entry::line, linetable_entry::line, linetable_entry::pc, print_source_lines(), PRINT_SOURCE_LINES_FILENAME, qsort, gdb::optional< T >::reset(), deprecated_dis_line_entry::start_pc, SYMTAB_LINETABLE, and ui_out::text().

Referenced by gdb_disassembly().

## ◆ dump_insns()

static int dump_insns | ( | struct gdbarch * | gdbarch,
|  | struct ui_out * | uiout,
|  | CORE_ADDR | low,
|  | CORE_ADDR | high,
|  | int | how_many,
|  | gdb_disassembly_flags | flags,
|  | CORE_ADDR * | end_pc
| ) |  |
| static

Definition at line 296 of file disasm.c.

References disasm_insn::addr, flags, memset(), gdb_pretty_print_disassembler::pretty_print_insn(), QUIT, and size.

Referenced by do_assembly_only(), do_mixed_source_and_assembly(), and do_mixed_source_and_assembly_deprecated().

## ◆ eq_dis_line_entry()

static int eq_dis_line_entry | ( | const void * | item_lhs,
|  | const void * | item_rhs
| ) |  |
| static

Definition at line 79 of file disasm.c.

References dis_line_entry::line, and dis_line_entry::symtab.

Referenced by allocate_dis_line_table().

## ◆ gdb_buffered_insn_length()

int gdb_buffered_insn_length | ( | struct gdbarch * | gdbarch,
|  | const gdb_byte * | insn,
|  | int | max_len,
|  | CORE_ADDR | addr
| ) |  |

Definition at line 871 of file disasm.c.

References gdb_buffered_insn_length_init_dis(), and gdbarch_print_insn().

Referenced by amd64_relocate_instruction(), fixup_riprel(), and i386_relocate_instruction().

## ◆ gdb_buffered_insn_length_init_dis()

static void gdb_buffered_insn_length_init_dis | ( | struct gdbarch * | gdbarch,
|  | struct disassemble_info * | di,
|  | const gdb_byte * | insn,
|  | int | max_len,
|  | CORE_ADDR | addr
| ) |  |
| static

Definition at line 844 of file disasm.c.

References gdbarch_bfd_arch_info(), gdbarch_byte_order(), gdbarch_byte_order_for_code(), and get_disassembler_options().

Referenced by gdb_buffered_insn_length().

## ◆ gdb_disassembly()

void gdb_disassembly | ( | struct gdbarch * | gdbarch,
|  | struct ui_out * | uiout,
|  | gdb_disassembly_flags | flags,
|  | int | how_many,
|  | CORE_ADDR | low,
|  | CORE_ADDR | high
| ) |  |

Definition at line 780 of file disasm.c.

References DISASSEMBLY_SOURCE, DISASSEMBLY_SOURCE_DEPRECATED, do_assembly_only(), do_mixed_source_and_assembly(), do_mixed_source_and_assembly_deprecated(), find_pc_line_symtab(), flags, gdb_flush(), gdb_stdout, symtab::nlines, and SYMTAB_LINETABLE.

Referenced by do_gdb_disassembly(), mi_cmd_disassemble(), and print_disassembly().

## ◆ gdb_insn_length()

int gdb_insn_length | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | addr
| ) |  |

Definition at line 826 of file disasm.c.

References gdb_print_insn(), and null_stream.

Referenced by arc_breakpoint_kind_from_pc(), btrace_compute_ftrace_bts(), do_mixed_source_and_assembly(), find_instruction_backward(), i386_fast_tracepoint_valid_at(), record_btrace_frame_prev_register(), and remote_download_tracepoint().

## ◆ gdb_print_insn()

int gdb_print_insn | ( | struct gdbarch * | gdbarch,
|  | CORE_ADDR | memaddr,
|  | struct ui_file * | stream,
|  | int * | branch_delay_insns
| ) |  |

Definition at line 813 of file disasm.c.

References branch_delay_insns, and gdb_disassembler::print_insn().

Referenced by archpy_disassemble(), gdb_insn_length(), gdbscm_arch_disassemble(), print_formatted(), recpy_bt_insn_decoded(), and tui_disassemble().

## ◆ get_disassembler_options()

char* get_disassembler_options | ( | struct gdbarch * | gdbarch | ) |

Definition at line 882 of file disasm.c.

References gdbarch_disassembler_options().

Referenced by gdb_buffered_insn_length_init_dis(), gdb_disassembler::gdb_disassembler(), show_disassembler_options_sfunc(), and show_disassembly_style_sfunc().

## ◆ hash_dis_line_entry()

static hashval_t hash_dis_line_entry | ( | const void * | item | ) |
| static

Definition at line 69 of file disasm.c.

References dis_line_entry::line, and dis_line_entry::symtab.

Referenced by allocate_dis_line_table().

## ◆ line_has_code_p()

static int line_has_code_p | ( | htab_t | table,
|  | struct symtab * | symtab,
|  | int | line
| ) |  |
| static

Definition at line 121 of file disasm.c.

References dis_line_entry::line, and dis_line_entry::symtab.

Referenced by do_mixed_source_and_assembly().

## ◆ set_disassembler_options()

void set_disassembler_options | ( | char * | prospective_options | ) |

Definition at line 891 of file disasm.c.

References _, gdbarch::disassembler_options, fprintf_filtered(), free(), gdb_stdlog, gdbarch_disassembler_options(), gdbarch_valid_disassembler_options(), get_current_arch(), and prospective_options.

Referenced by set_disassembler_options_sfunc(), and set_disassembly_style_sfunc().

## ◆ set_disassembler_options_sfunc()

static void set_disassembler_options_sfunc | ( | const char * | args,
|  | int | from_tty,
|  | struct cmd_list_element * | c
| ) |  |
| static

Definition at line 940 of file disasm.c.

References prospective_options, and set_disassembler_options().

Referenced by _initialize_disasm().

## ◆ show_disassembler_options_sfunc()

static void show_disassembler_options_sfunc | ( | struct ui_file * | file,
|  | int | from_tty,
|  | struct cmd_list_element * | c,
|  | const char * | value
| ) |  |
| static

Definition at line 947 of file disasm.c.

References _, fprintf_filtered(), gdbarch_valid_disassembler_options(), get_current_arch(), get_disassembler_options(), and wrap_here().

Referenced by _initialize_disasm().

## Variable Documentation

## ◆ prospective_options

char* prospective_options = NULL
| static

Definition at line 40 of file disasm.c.

Referenced by _initialize_disasm(), set_disassembler_options(), and set_disassembler_options_sfunc().