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)
125 return status != NULL ? -1 : 0;
132 port (port_),
offset (offset_)
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;
196 start_scm, &start_arg, rest,
197 &port_arg_pos, &port,
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;
245 for (pc = start, i = 0; pc <= end && i < count; )
273 return scm_reverse_x (result, SCM_EOL);
282 Return list of disassembled instructions in memory.\n\ 284 Arguments: <gdb:arch> start-address\n\ 285 [#:port port] [#:offset address]\n\ 286 [#:size <integer>] [#:count <integer>]\n\ 287 port: If non-#f, it is an input port to read bytes from.\n\ 288 offset: Specifies the address offset of the first byte in the port.\n\ 289 This is useful if the input is from something other than memory\n\ 290 (e.g., a bytevector) and you want the result to be as if the bytes\n\ 291 came from that address. The value to pass for start-address is\n\ 292 then also the desired disassembly address, not the offset in, e.g.,\n\ 294 size: Limit the number of bytes read to this amount.\n\ 295 count: Limit the number of instructions to this amount.\n\ 298 Each instruction in the result is an alist:\n\ 299 (('address . address) ('asm . disassembly) ('length . length))." },
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))
void gdbscm_define_functions(const scheme_function *, int is_public)
SCM gdbscm_scm_from_ulongest(ULONGEST l)
static int branch_delay_insns
static const scheme_function disasm_functions[]
int print_insn(CORE_ADDR memaddr, int *branch_delay_insns=NULL)
static int gdbscm_print_insn_from_port(struct gdbarch *gdbarch, SCM port, ULONGEST offset, CORE_ADDR memaddr, string_file *stream, int *branch_delay_insns)
struct gdbarch * arscm_get_gdbarch(arch_smob *a_smob)
static SCM gdbscm_arch_disassemble(SCM self, SCM start_scm, SCM rest)
#define gdbscm_is_true(scm)
static const char * gdbscm_disasm_read_memory_worker(void *datap)
#define CATCH(EXCEPTION, MASK)
static SCM dascm_make_insn(CORE_ADDR pc, const char *assembly, int insn_len)
const char * gdbscm_with_guile(const char *(*func)(void *), void *data)
SCM gdbscm_scm_from_c_string(const char *string)
#define gdbscm_is_false(scm)
static int gdbscm_disasm_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *dinfo)
int gdb_print_insn(struct gdbarch *gdbarch, CORE_ADDR memaddr, struct ui_file *stream, int *branch_delay_insns)
static SCM offset_keyword
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
gdbscm_disassembler(struct gdbarch *gdbarch, struct ui_file *stream, SCM port, ULONGEST offset)
gdbscm_disassembler * dinfo
struct ui_file * stream()
const char * c_str() const
void gdbscm_out_of_range_error(const char *subr, int arg_pos, SCM bad_value, const char *error) ATTRIBUTE_NORETURN
void gdbscm_initialize_disasm(void)
static SCM address_symbol
void gdbscm_parse_function_args(const char *function_name, int beginning_arg_pos, const SCM *keywords, const char *format,...)
unsigned long long ULONGEST
#define GDBSCM_HANDLE_GDB_EXCEPTION(exception)