From: Andrew Cagney Date: Fri, 2 Apr 2004 19:44:25 +0000 (+0000) Subject: 2004-04-02 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=304396fba9a40662a849f6a116351f3b508bcd68;p=binutils-gdb.git 2004-04-02 Andrew Cagney * frame.c (safe_frame_unwind_memory): New function. * frame.h (safe_frame_unwind_memory): Declare. Update description of /safe_/ methods. * tramp-frame.c (tramp_frame_start): Re-order parmeters, add "next_frame". Use safe_frame_unwind_memory. (tramp_frame_sniffer): Update call to tramp_frame_start. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2a9ad26a81..cf9cbdd426b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2004-04-02 Andrew Cagney + + * frame.c (safe_frame_unwind_memory): New function. + * frame.h (safe_frame_unwind_memory): Declare. Update description + of /safe_/ methods. + * tramp-frame.c (tramp_frame_start): Re-order parmeters, add + "next_frame". Use safe_frame_unwind_memory. + (tramp_frame_sniffer): Update call to tramp_frame_start. + 2004-04-01 Daniel Jacobowitz * dwarf2read.c (dwarf2_objfile_data_key): New. diff --git a/gdb/frame.c b/gdb/frame.c index d725e8758dd..bc043979473 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2270,6 +2270,14 @@ get_frame_memory_unsigned (struct frame_info *this_frame, CORE_ADDR addr, return read_memory_unsigned_integer (addr, len); } +int +safe_frame_unwind_memory (struct frame_info *this_frame, + CORE_ADDR addr, void *buf, int len) +{ + /* NOTE: read_memory_nobpt returns zero on success! */ + return !read_memory_nobpt (addr, buf, len); +} + /* Architecture method. */ struct gdbarch * diff --git a/gdb/frame.h b/gdb/frame.h index 3e38c6106b5..32b3efaa26b 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -40,8 +40,8 @@ strongly hinting at its unsafeness) safe_....(): Safer version of various functions, doesn't throw an - error (leave this for later?). Returns non-zero if the fetch - succeeds. Return a freshly allocated error message? + error (leave this for later?). Returns non-zero / non-NULL if the + request succeeds, zero / NULL otherwize. Suffixes: @@ -461,6 +461,11 @@ extern LONGEST get_frame_memory_signed (struct frame_info *this_frame, extern ULONGEST get_frame_memory_unsigned (struct frame_info *this_frame, CORE_ADDR memaddr, int len); +/* Same as above, but return non-zero when the entire memory read + succeeds, zero otherwize. */ +extern int safe_frame_unwind_memory (struct frame_info *this_frame, + CORE_ADDR addr, void *buf, int len); + /* Return this frame's architecture. */ extern struct gdbarch *get_frame_arch (struct frame_info *this_frame); diff --git a/gdb/tramp-frame.c b/gdb/tramp-frame.c index ee3635f743b..528603c7452 100644 --- a/gdb/tramp-frame.c +++ b/gdb/tramp-frame.c @@ -85,7 +85,8 @@ tramp_frame_prev_register (struct frame_info *next_frame, } static CORE_ADDR -tramp_frame_start (CORE_ADDR pc, const struct tramp_frame *tramp) +tramp_frame_start (const struct tramp_frame *tramp, + struct frame_info *next_frame, CORE_ADDR pc) { int ti; /* Search through the trampoline for one that matches the @@ -100,8 +101,9 @@ tramp_frame_start (CORE_ADDR pc, const struct tramp_frame *tramp) ULONGEST insn; if (tramp->insn[i] == TRAMP_SENTINEL_INSN) return func; - if (target_read_memory (func + i * tramp->insn_size, buf, - tramp->insn_size) != 0) + if (!safe_frame_unwind_memory (next_frame, + func + i * tramp->insn_size, + buf, tramp->insn_size)) break; insn = extract_unsigned_integer (buf, tramp->insn_size); if (tramp->insn[i] != insn) @@ -133,7 +135,7 @@ tramp_frame_sniffer (const struct frame_unwind *self, if (find_pc_section (pc) != NULL) return 0; /* Finally, check that the trampoline matches at PC. */ - func = tramp_frame_start (pc, tramp); + func = tramp_frame_start (tramp, next_frame, pc); if (func == 0) return 0; tramp_cache = FRAME_OBSTACK_ZALLOC (struct tramp_frame_cache);