This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH]: xstormy16-tdep.c, xstormy16_skip_prologue() better handles frameless functions
- From: Corinna Vinschen <vinschen at redhat dot com>
- To: gdb-patches <gdb-patches at sources dot redhat dot com>
- Date: Tue, 22 Jan 2002 12:27:10 +0100
- Subject: [PATCH]: xstormy16-tdep.c, xstormy16_skip_prologue() better handles frameless functions
- Reply-to: gdb-patches <gdb-patches at sources dot redhat dot com>
Hi,
I applied the following patch to xstormy16-tdep.c. Basically it
handles frameless functions better by not using the .debug_line
information for skipping the prologue but instead using the
machine code scanning instead. That's not optimal but it actually
works better for that CPU.
Corinna
2002-01-22 Corinna Vinschen <vinschen@redhat.com>
* xstormy16-tdep.c (xstormy16_scan_prologue): Add frameless
parameter. Set frameless flag if it exists and depended of
whether the scanned function is frameless or not.
(xstormy16_skip_prologue): If function is frameless, return
result of xstormy16_scan_prologue().
(xstormy16_frame_init_saved_regs): Adjust xstormy16_scan_prologue()
call.
Index: xstormy16-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/xstormy16-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 xstormy16-tdep.c
--- xstormy16-tdep.c 2001/12/13 13:34:39 1.1
+++ xstormy16-tdep.c 2002/01/22 11:21:50
@@ -451,8 +451,8 @@ xstormy16_frame_saved_register (struct f
*/
static CORE_ADDR
-xstormy16_scan_prologue (CORE_ADDR start_addr,
- CORE_ADDR end_addr, struct frame_info *fi)
+xstormy16_scan_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
+ struct frame_info *fi, int *frameless)
{
CORE_ADDR sp = 0, fp = 0;
CORE_ADDR next_addr;
@@ -460,6 +460,8 @@ xstormy16_scan_prologue (CORE_ADDR start
LONGEST offset;
int regnum;
+ if (frameless)
+ *frameless = 1;
if (fi)
{
/* In a call dummy, don't touch the frame. */
@@ -518,6 +520,8 @@ xstormy16_scan_prologue (CORE_ADDR start
{
if (fi) /* Record that the frame pointer is in use. */
fi->extra_info->frameless_p = 0;
+ if (frameless)
+ *frameless = 0;
}
/* optional copying of args in r2-r7 to r10-r13 */
@@ -633,11 +637,18 @@ xstormy16_skip_prologue (CORE_ADDR pc)
struct symtab_and_line sal;
struct symbol *sym;
+ /* Don't trust line number debug info in frameless functions. */
+ int frameless = 1;
+ CORE_ADDR plg_end = xstormy16_scan_prologue (func_addr, func_end,
+ NULL, &frameless);
+ if (frameless)
+ return plg_end;
+
/* Found a function. */
sym = lookup_symbol (func_name, NULL, VAR_NAMESPACE, NULL, NULL);
+ /* Don't use line number debug info for assembly source files. */
if (sym && SYMBOL_LANGUAGE (sym) != language_asm)
{
- /* Don't use this trick for assembly source files. */
sal = find_pc_line (func_addr, 0);
if (sal.end && sal.end < func_end)
{
@@ -645,8 +656,8 @@ xstormy16_skip_prologue (CORE_ADDR pc)
return sal.end;
}
}
- /* No useable line symbol. Use prologue parsing method. */
- return xstormy16_scan_prologue (func_addr, func_end, NULL);
+ /* No useable line symbol. Use result of prologue parsing method. */
+ return plg_end;
}
/* No function symbol -- just return the PC. */
@@ -727,7 +738,7 @@ xstormy16_frame_init_saved_regs (struct
/* Find the beginning of this function, so we can analyze its
prologue. */
if (find_pc_partial_function (fi->pc, NULL, &func_addr, &func_end))
- xstormy16_scan_prologue (func_addr, fi->pc, fi);
+ xstormy16_scan_prologue (func_addr, fi->pc, fi, NULL);
/* Else we're out of luck (can't debug completely stripped code).
FIXME. */
}
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com