This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix another get_frame_arch (NULL) call
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 21 Aug 2008 22:31:15 +0200 (CEST)
- Subject: [commit] Fix another get_frame_arch (NULL) call
Hello,
another location where get_frame_arch (NULL) was called: locate_var_value
has a frame argument that may be NULL in some cases. Make sure it is used
as an argument to get_frame_arch only in those cases where it is non-NULL.
Tested on powerpc-linux and powerpc64-linux.
Committed to mainline.
Bye,
Ulrich
ChangeLog:
* findvar.c (locate_var_value): Do not call get_frame_arch
with a NULL frame argument.
diff -urNp src-orig/gdb/findvar.c src/gdb/findvar.c
--- src-orig/gdb/findvar.c 2008-07-15 19:53:11.000000000 +0200
+++ src/gdb/findvar.c 2008-08-20 17:20:21.597694175 +0200
@@ -660,7 +660,7 @@ address_from_register (struct type *type
struct value *
locate_var_value (struct symbol *var, struct frame_info *frame)
{
- struct gdbarch *gdbarch = get_frame_arch (frame);
+ struct gdbarch *gdbarch;
CORE_ADDR addr = 0;
struct type *type = SYMBOL_TYPE (var);
struct value *lazy_value;
@@ -686,6 +686,8 @@ locate_var_value (struct symbol *var, st
switch (VALUE_LVAL (lazy_value))
{
case lval_register:
+ gdb_assert (frame);
+ gdbarch = get_frame_arch (frame);
gdb_assert (gdbarch_register_name
(gdbarch, VALUE_REGNUM (lazy_value)) != NULL
&& *gdbarch_register_name
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com