74 scm_from_int (insn_len)));
91 newpos = scm_seek (port, seekto, scm_from_int (
SEEK_SET));
92 if (!scm_is_eq (seekto, newpos))
95 bytes_read = scm_c_read (port, data->myaddr, data->length);
97 if (bytes_read != data->length)
109 struct disassemble_info *
dinfo)
noexcept
125 return status != NULL ? -1 : 0;
130 SCM port_, ULONGEST offset_)
132 port (port_), offset (offset_)
148 SCM port, ULONGEST offset, CORE_ADDR
memaddr,
179 const SCM keywords[] = {
182 int port_arg_pos = -1, offset_arg_pos = -1;
183 int size_arg_pos = -1, count_arg_pos = -1;
184 SCM port = SCM_BOOL_F;
186 unsigned int count = 1;
189 CORE_ADDR start, end;
196 start_scm, &start_arg, rest,
197 &port_arg_pos, &port,
198 &offset_arg_pos, &offset,
199 &size_arg_pos, &
size,
200 &count_arg_pos, &count);
205 if (port_arg_pos > 0)
209 port, port_arg_pos,
FUNC_NAME, _(
"input port"));
213 if (offset_arg_pos > 0
219 _(
"offset provided but port is missing"));
222 if (size_arg_pos > 0)
228 if (start +
size < start)
233 _(
"start+size overflows"));
235 end = start +
size - 1;
238 end = ~(CORE_ADDR) 0;
245 for (pc = start, i = 0; pc <= end && i < count; )
261 catch (
const gdb_exception &except)
274 return scm_reverse_x (result, SCM_EOL);
283Return list of disassembled instructions in memory.\n\
285 Arguments: <gdb:arch> start-address\n\
286 [#:port port] [#:offset address]\n\
287 [#:size <integer>] [#:count <integer>]\n\
288 port: If non-#f, it is an input port to read bytes from.\n\
289 offset: Specifies the address offset of the first byte in the port.\n\
290 This is useful if the input is from something other than memory\n\
291 (e.g., a bytevector) and you want the result to be as if the bytes\n\
292 came from that address. The value to pass for start-address is\n\
293 then also the desired disassembly address, not the offset in, e.g.,\n\
295 size: Limit the number of bytes read to this amount.\n\
296 count: Limit the number of instructions to this amount.\n\
299 Each instruction in the result is an alist:\n\
300 (('address . address) ('asm . disassembly) ('length . length))." },
gdbscm_disassembler(struct gdbarch *gdbarch, struct ui_file *stream, SCM port, ULONGEST offset)
const char * c_str() const
int gdb_print_insn(struct gdbarch *gdbarch, CORE_ADDR memaddr, struct ui_file *stream, int *branch_delay_insns)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
#define gdbscm_is_true(scm)
void gdbscm_parse_function_args(const char *function_name, int beginning_arg_pos, const SCM *keywords, const char *format,...)
gdbscm_gdb_exception unpack(const gdb_exception &exc)
void gdbscm_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
#define gdbscm_is_false(scm)
SCM gdbscm_scm_from_ulongest(ULONGEST l)
const char * gdbscm_with_guile(const char *(*func)(void *), void *data)
void gdbscm_define_functions(const scheme_function *, int is_public)
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)
struct gdbarch * arscm_get_gdbarch(arch_smob *a_smob)
arch_smob * arscm_get_arch_smob_arg_unsafe(SCM arch_scm, int arg_pos, const char *func_name)
static scm_t_subr as_a_scm_t_subr(SCM(*func)(void))
SCM gdbscm_scm_from_c_string(const char *string)
static int branch_delay_insns
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 const char * gdbscm_disasm_read_memory_worker(void *datap)
static SCM address_symbol
static const scheme_function disasm_functions[]
void gdbscm_initialize_disasm(void)
static SCM offset_keyword
static int gdbscm_disasm_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *dinfo) noexcept
static SCM gdbscm_arch_disassemble(SCM self, SCM start_scm, SCM rest)
static SCM dascm_make_insn(CORE_ADDR pc, const char *assembly, int insn_len)
int print_insn(CORE_ADDR memaddr, int *branch_delay_insns=NULL)
struct ui_file * stream()
gdbscm_disassembler * dinfo