This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] ia64-tdep.c: Only warn about slot numbers > 2
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH] ia64-tdep.c: Only warn about slot numbers > 2
- From: Kevin Buettner <kevinb at cygnus dot com>
- Date: Wed, 21 Mar 2001 19:34:10 -0700
- Cc: Trond Eivind Glomsrød <teg at redhat dot com>
I've just committed the changes below.
This patch addresses the concerns raised in the following bug report:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=32544
In particular, GDB doesn't segfault anymore. A warning message
regarding slot numbers that are greater than zero is still printed,
but IMO, it is better to print these to alert the user that something
may wrong...
* ia64-tdep.c (fetch_instruction): Warn about slot numbers greater
than two instead of generating an error.
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.15
diff -u -p -r1.15 ia64-tdep.c
--- ia64-tdep.c 2001/03/01 01:39:21 1.15
+++ ia64-tdep.c 2001/03/22 01:55:48
@@ -492,8 +492,25 @@ fetch_instruction (CORE_ADDR addr, instr
long long template;
int val;
+ /* Warn about slot numbers greater than 2. We used to generate
+ an error here on the assumption that the user entered an invalid
+ address. But, sometimes GDB itself requests an invalid address.
+ This can (easily) happen when execution stops in a function for
+ which there are no symbols. The prologue scanner will attempt to
+ find the beginning of the function - if the nearest symbol
+ happens to not be aligned on a bundle boundary (16 bytes), the
+ resulting starting address will cause GDB to think that the slot
+ number is too large.
+
+ So we warn about it and set the slot number to zero. It is
+ not necessarily a fatal condition, particularly if debugging
+ at the assembly language level. */
if (slotnum > 2)
- error("Can't fetch instructions for slot numbers greater than 2.");
+ {
+ warning ("Can't fetch instructions for slot numbers greater than 2.\n"
+ "Using slot 0 instead");
+ slotnum = 0;
+ }
addr &= ~0x0f;