Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: patch to display ia64 function pointers
@ 2003-07-31 22:01 J. Johnston
  2003-08-25 21:12 ` Kevin Buettner
  0 siblings, 1 reply; 9+ messages in thread
From: J. Johnston @ 2003-07-31 22:01 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 597 bytes --]

The following patch fixes the problem when displaying structs or function
pointers that actually point to a function descriptor per the ia64 ABI.
Currently, the function descriptor pointer is erroneously interpreted as
pointing to a function and so gdb spits out some meaningless information.

With the patch, you get to see the actual function that the pointer
is referencing via the function descriptor.

Ok to commit?

2003-07-31  Jeff Johnston  <jjohnstn@redhat.com>

	* ia64-tdep.c (ia64_convert_from_func_addr): New function.
	(ia64_gdbarch_init): Call set_gdbarch_convert_from_func_addr().

[-- Attachment #2: ia64-tdep.funcdesc.patch --]
[-- Type: text/plain, Size: 1575 bytes --]

Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.92
diff -u -p -r1.92 ia64-tdep.c
--- ia64-tdep.c	23 Jul 2003 18:32:19 -0000	1.92
+++ ia64-tdep.c	31 Jul 2003 21:55:46 -0000
@@ -1852,6 +1852,23 @@ find_func_descr (CORE_ADDR faddr, CORE_A
   return fdesc; 
 }
 
+/* Use the following routine when printing out function pointers
+   so the user can see the function address rather than just the
+   function descriptor.  */
+static CORE_ADDR
+ia64_convert_from_func_ptr_addr (CORE_ADDR addr)
+{
+  struct obj_section *s;
+
+  s = find_pc_section (addr);
+
+  /* check if ADDR points to a function descriptor.  */
+  if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
+    return read_memory_unsigned_integer (addr, 8);
+
+  return addr;
+}
+
 static CORE_ADDR
 ia64_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
 		      struct regcache *regcache, CORE_ADDR bp_addr,
@@ -2277,6 +2294,7 @@ ia64_gdbarch_init (struct gdbarch_info i
   set_gdbarch_deprecated_register_convertible (gdbarch, ia64_register_convertible);
   set_gdbarch_deprecated_register_convert_to_virtual (gdbarch, ia64_register_convert_to_virtual);
   set_gdbarch_deprecated_register_convert_to_raw (gdbarch, ia64_register_convert_to_raw);
+  set_gdbarch_convert_from_func_ptr_addr (gdbarch, ia64_convert_from_func_ptr_addr);
 
   set_gdbarch_use_struct_convention (gdbarch, ia64_use_struct_convention);
   set_gdbarch_deprecated_extract_return_value (gdbarch, ia64_extract_return_value);

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: RFA: patch to display ia64 function pointers
@ 2003-08-26 19:46 Michael Elizabeth Chastain
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-26 19:46 UTC (permalink / raw)
  To: jjohnstn, kevinb; +Cc: gdb-patches

jj> I am also about to submit a change to prologue examination
jj> to handle glibc's sleep() function.

Hoo hah, that sounds familiar.

Also check select() while you are at it.  On my i686-pc-linux-gnu
most of the test suite problems showed up with sleep(), but real code
is more likely to be in select().

And check out testsuite/gdb.arch/i386-prologue.exp i386-prologue.c.

This has to be done for a lot of targets.  :(  Daniel J suggested
using the s390-tdep.c 'abstract execution' engine on every target
and I think that's a good idea.

Michael C


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-09-09  3:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-31 22:01 RFA: patch to display ia64 function pointers J. Johnston
2003-08-25 21:12 ` Kevin Buettner
2003-08-26 17:34   ` J. Johnston
2003-08-26 22:37     ` [patch] missing case in epilogue stub detection Jafa
2003-08-26 22:45       ` Daniel Jacobowitz
2003-08-26 23:01         ` Jafa
2003-09-07 15:16           ` Daniel Jacobowitz
2003-09-09  3:00             ` Andrew Cagney
2003-08-26 19:46 RFA: patch to display ia64 function pointers Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox