This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] Add assert to catch get_frame_arch (NULL) calls
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 13 Jan 2009 19:06:39 +0100 (CET)
- Subject: [rfc] Add assert to catch get_frame_arch (NULL) calls
Hello,
to prevent get_frame_arch (NULL) problems from being accidentally
re-introduced, this patch adds an assertion to get_frame_arch.
Tested with no regressions on powerpc-linux.
If there are no objections to this, I'm planning on committing
the patch within a couple of days ...
Bye,
Ulrich
ChangeLog:
* frame.c (get_frame_arch): Abort if called with NULL this_frame.
Index: gdb/frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.257
diff -c -p -r1.257 frame.c
*** gdb/frame.c 3 Jan 2009 05:57:51 -0000 1.257
--- gdb/frame.c 13 Jan 2009 17:51:38 -0000
*************** safe_frame_unwind_memory (struct frame_i
*** 1795,1800 ****
--- 1795,1805 ----
struct gdbarch *
get_frame_arch (struct frame_info *this_frame)
{
+ /* In the future, this function will return a per-frame
+ architecture instead of current_gdbarch. Calling the
+ routine with a NULL value of this_frame is a bug! */
+ gdb_assert (this_frame);
+
return current_gdbarch;
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com