GDB (xrefs)

Classes | Functions | Variables
scm-disasm.c File Reference
`#include "defs.h"`
`#include "arch-utils.h"`
`#include "disasm.h"`
`#include "dis-asm.h"`
`#include "gdbarch.h"`
`#include "gdbcore.h"`
`#include "guile-internal.h"`

Go to the source code of this file.

## Classes
class | gdbscm_disassembler
struct | gdbscm_disasm_read_data

## Functions
static SCM | dascm_make_insn (CORE_ADDR pc, const char *assembly, int insn_len)
static const char * | gdbscm_disasm_read_memory_worker (void *datap)
static int | gdbscm_disasm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *dinfo)
static int | gdbscm_print_insn_from_port (struct gdbarch *gdbarch, SCM port, ULONGEST offset, CORE_ADDR memaddr, string_file *stream, int *branch_delay_insns)
static SCM | gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
void | gdbscm_initialize_disasm (void)

## Variables
static SCM | port_keyword
static SCM | offset_keyword
static SCM | size_keyword
static SCM | count_keyword
static SCM | address_symbol
static SCM | asm_symbol
static SCM | length_symbol
static const scheme_function | disasm_functions []

## Function Documentation

## ◆ dascm_make_insn()

static SCM dascm_make_insn | ( | CORE_ADDR | pc,
|  | const char * | assembly,
|  | int | insn_len
| ) |  |
| static

Definition at line 67 of file scm-disasm.c.

References address_symbol, asm_symbol, gdbscm_scm_from_c_string(), gdbscm_scm_from_ulongest(), and length_symbol.

Referenced by gdbscm_arch_disassemble().

## ◆ gdbscm_arch_disassemble()

static SCM gdbscm_arch_disassemble | ( | SCM | self,
|  | SCM | start_scm,
|  | SCM | rest
| ) |  |
| static

Definition at line 174 of file scm-disasm.c.

References _, arscm_get_arch_smob_arg_unsafe(), arscm_get_gdbarch(), string_file::c_str(), CATCH, count_keyword, dascm_make_insn(), END_CATCH, FUNC_NAME, gdb_print_insn(), GDBSCM_HANDLE_GDB_EXCEPTION, gdbscm_is_false, gdbscm_is_true, gdbscm_out_of_range_error(), gdbscm_parse_function_args(), gdbscm_print_insn_from_port(), gdbscm_scm_from_ulongest(), offset, offset_keyword, port_keyword, RETURN_MASK_ALL, size, size_keyword, and TRY.

## ◆ gdbscm_disasm_read_memory()

static int gdbscm_disasm_read_memory | ( | bfd_vma | memaddr,
|  | bfd_byte * | myaddr,
|  | unsigned int | length,
|  | struct disassemble_info * | dinfo
| ) |  |
| static

Definition at line 107 of file scm-disasm.c.

References gdbscm_disasm_read_data::dinfo, gdbscm_disasm_read_memory_worker(), gdbscm_with_guile(), gdbscm_disasm_read_data::length, gdbscm_disasm_read_data::memaddr, gdbscm_disasm_read_data::myaddr, and status.

## ◆ gdbscm_disasm_read_memory_worker()

static const char* gdbscm_disasm_read_memory_worker | ( | void * | datap | ) |
| static

Definition at line 82 of file scm-disasm.c.

References gdbscm_disasm_read_data::dinfo, gdbscm_scm_from_ulongest(), gdbscm_disasm_read_data::length, gdbscm_disasm_read_data::memaddr, gdbscm_disasm_read_data::myaddr, gdbscm_disassembler::offset, gdbscm_disassembler::port, and SEEK_SET.

Referenced by gdbscm_disasm_read_memory().

## ◆ gdbscm_initialize_disasm()

void gdbscm_initialize_disasm | ( | void |  | ) |

Definition at line 305 of file scm-disasm.c.

References address_symbol, asm_symbol, count_keyword, disasm_functions, gdbscm_define_functions(), length_symbol, offset_keyword, port_keyword, and size_keyword.

## ◆ gdbscm_print_insn_from_port()

static int gdbscm_print_insn_from_port | ( | struct gdbarch * | gdbarch,
|  | SCM | port,
|  | ULONGEST | offset,
|  | CORE_ADDR | memaddr,
|  | string_file * | stream,
|  | int * | branch_delay_insns
| ) |  |
| static

Definition at line 147 of file scm-disasm.c.

References branch_delay_insns, gdbscm_disasm_read_data::memaddr, offset, and gdb_disassembler::print_insn().

Referenced by gdbscm_arch_disassemble().

## Variable Documentation

## ◆ address_symbol

SCM address_symbol
| static

Definition at line 36 of file scm-disasm.c.

Referenced by dascm_make_insn(), and gdbscm_initialize_disasm().

## ◆ asm_symbol

SCM asm_symbol
| static

Definition at line 37 of file scm-disasm.c.

Referenced by dascm_make_insn(), and gdbscm_initialize_disasm().

## ◆ count_keyword

SCM count_keyword
| static

Definition at line 34 of file scm-disasm.c.

Referenced by gdbscm_arch_disassemble(), and gdbscm_initialize_disasm().

## ◆ disasm_functions

const scheme_function disasm_functions[]
| static

Initial value:
=
{
{ "arch-disassemble", 2, 0, 1, as_a_scm_t_subr (gdbscm_arch_disassemble),
"\
Return list of disassembled instructions in memory.\n\
\n\
Arguments: <gdb:arch> start-address\n\
[#:port port] [#:offset address]\n\
[#:size <integer>] [#:count <integer>]\n\
port: If non-#f, it is an input port to read bytes from.\n\
offset: Specifies the address offset of the first byte in the port.\n\
This is useful if the input is from something other than memory\n\
(e.g., a bytevector) and you want the result to be as if the bytes\n\
came from that address. The value to pass for start-address is\n\
then also the desired disassembly address, not the offset in, e.g.,\n\
the bytevector.\n\
size: Limit the number of bytes read to this amount.\n\
count: Limit the number of instructions to this amount.\n\
\n\
Returns:\n\
Each instruction in the result is an alist:\n\
(('address . address) ('asm . disassembly) ('length . length))." },
END_FUNCTIONS
}
as_a_scm_t_subr
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
Definition: guile-internal.h:66
gdbscm_arch_disassemble
static SCM gdbscm_arch_disassemble(SCM self, SCM start_scm, SCM rest)
Definition: scm-disasm.c:174
END_FUNCTIONS
#define END_FUNCTIONS
Definition: guile-internal.h:103

Definition at line 278 of file scm-disasm.c.

Referenced by gdbscm_initialize_disasm().

## ◆ length_symbol

SCM length_symbol
| static

Definition at line 38 of file scm-disasm.c.

Referenced by dascm_make_insn(), and gdbscm_initialize_disasm().

## ◆ offset_keyword

SCM offset_keyword
| static

Definition at line 32 of file scm-disasm.c.

Referenced by gdbscm_arch_disassemble(), and gdbscm_initialize_disasm().

## ◆ port_keyword

SCM port_keyword
| static

Definition at line 31 of file scm-disasm.c.

Referenced by gdbscm_arch_disassemble(), and gdbscm_initialize_disasm().

## ◆ size_keyword

SCM size_keyword
| static

Definition at line 33 of file scm-disasm.c.

Referenced by gdbscm_arch_disassemble(), and gdbscm_initialize_disasm().