* [RFA] Pb stepping inside DLL function
@ 2004-06-24 0:22 Joel Brobecker
2004-06-24 0:23 ` Joel Brobecker
2004-06-24 0:27 ` Michael Snyder
0 siblings, 2 replies; 5+ messages in thread
From: Joel Brobecker @ 2004-06-24 0:22 UTC (permalink / raw)
To: gdb-patches
Hello,
We have the following little C program (a.c):
#include <stdio.h>
extern _stdcall int sub ();
main ()
{
int a = 0;
a = sub ();
printf ("%d\n", a);
}
``sub()'' is a function provided by a DLL. It has all the necessary
debug information. The following transcript shows that GDB is currently
unable to step into sub():
(gdb) start
Breakpoint 1 at 0x4012d2: file a.c, line 7.
Starting program: /[...]/a.exe
main () at a.c:7
7 int a = 0;
(gdb) step
9 a = sub ();
(gdb) p a
$1 = 0
(gdb) step
10 printf ("%d\n", a);
(gdb) print a
$2 = 5
During the step, GDB lands inside sub@0, which is the trampoline
for sub(), but doesn't realize it. The fix is to teach GDB how to
recognize them, and hand to find where they will eventually take us.
For that, I found a function that was actually dead but did exactly
what I needed, so I reused it.
2004-06-23 Joel Brobecker <brobecker@gnat.com>
* i386-cygwin-tdep.c (i386-cygwin-tdep.c): New function.
(i386_cygwin_in_solib_call_trampoline): New function.
(i386_cygwin_init_abi): Initialize the in_solib_call_trampoline
and skip_trampoline_code gdbarch methods.
Tested on x86-windows (XP), no regression.
OK to apply?
Thanks,
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] Pb stepping inside DLL function
2004-06-24 0:22 [RFA] Pb stepping inside DLL function Joel Brobecker
@ 2004-06-24 0:23 ` Joel Brobecker
2004-06-29 14:35 ` Christopher Faylor
2004-06-24 0:27 ` Michael Snyder
1 sibling, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2004-06-24 0:23 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]
[Sigh... With the patch, this time...]
Hello,
We have the following little C program (a.c):
#include <stdio.h>
extern _stdcall int sub ();
main ()
{
int a = 0;
a = sub ();
printf ("%d\n", a);
}
``sub()'' is a function provided by a DLL. It has all the necessary
debug information. The following transcript shows that GDB is currently
unable to step into sub():
(gdb) start
Breakpoint 1 at 0x4012d2: file a.c, line 7.
Starting program: /[...]/a.exe
main () at a.c:7
7 int a = 0;
(gdb) step
9 a = sub ();
(gdb) p a
$1 = 0
(gdb) step
10 printf ("%d\n", a);
(gdb) print a
$2 = 5
During the step, GDB lands inside sub@0, which is the trampoline
for sub(), but doesn't realize it. The fix is to teach GDB how to
recognize them, and hand to find where they will eventually take us.
For that, I found a function that was actually dead but did exactly
what I needed, so I reused it.
2004-06-23 Joel Brobecker <brobecker@gnat.com>
* i386-cygwin-tdep.c (i386-cygwin-tdep.c): New function.
(i386_cygwin_in_solib_call_trampoline): New function.
(i386_cygwin_init_abi): Initialize the in_solib_call_trampoline
and skip_trampoline_code gdbarch methods.
Tested on x86-windows (XP), no regression.
OK to apply?
Thanks,
--
Joel
[-- Attachment #2: step-dll.diff --]
[-- Type: text/plain, Size: 1032 bytes --]
Index: i386-cygwin-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-cygwin-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 i386-cygwin-tdep.c
--- i386-cygwin-tdep.c 30 Apr 2004 21:13:58 -0000 1.5
+++ i386-cygwin-tdep.c 24 Jun 2004 00:12:25 -0000
@@ -26,11 +26,27 @@
#include "i386-tdep.h"
+static CORE_ADDR
+i386_cygwin_skip_trampoline_code (CORE_ADDR pc)
+{
+ return i386_pe_skip_trampoline_code (pc, NULL);
+}
+
+static int
+i386_cygwin_in_solib_call_trampoline (CORE_ADDR pc, char *name)
+{
+ return (i386_pe_skip_trampoline_code (pc, name) != 0);
+}
+
static void
i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ set_gdbarch_in_solib_call_trampoline (gdbarch,
+ i386_cygwin_in_solib_call_trampoline);
+ set_gdbarch_skip_trampoline_code (gdbarch, i386_cygwin_skip_trampoline_code);
+
tdep->struct_return = reg_struct_return;
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] Pb stepping inside DLL function
2004-06-24 0:23 ` Joel Brobecker
@ 2004-06-29 14:35 ` Christopher Faylor
2004-06-29 18:18 ` Joel Brobecker
0 siblings, 1 reply; 5+ messages in thread
From: Christopher Faylor @ 2004-06-29 14:35 UTC (permalink / raw)
To: gdb-patches
On Wed, Jun 23, 2004 at 05:23:05PM -0700, Joel Brobecker wrote:
>2004-06-23 Joel Brobecker <brobecker@gnat.com>
>
> * i386-cygwin-tdep.c (i386-cygwin-tdep.c): New function.
> (i386_cygwin_in_solib_call_trampoline): New function.
> (i386_cygwin_init_abi): Initialize the in_solib_call_trampoline
> and skip_trampoline_code gdbarch methods.
>
>Tested on x86-windows (XP), no regression.
>OK to apply?
Sorry for the delay, Joel.
Yes, please apply.
Thanks.
cgf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] Pb stepping inside DLL function
2004-06-29 14:35 ` Christopher Faylor
@ 2004-06-29 18:18 ` Joel Brobecker
0 siblings, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2004-06-29 18:18 UTC (permalink / raw)
To: gdb-patches
> On Wed, Jun 23, 2004 at 05:23:05PM -0700, Joel Brobecker wrote:
> >2004-06-23 Joel Brobecker <brobecker@gnat.com>
> >
> > * i386-cygwin-tdep.c (i386-cygwin-tdep.c): New function.
> > (i386_cygwin_in_solib_call_trampoline): New function.
> > (i386_cygwin_init_abi): Initialize the in_solib_call_trampoline
> > and skip_trampoline_code gdbarch methods.
> >
> >Tested on x86-windows (XP), no regression.
> >OK to apply?
>
> Sorry for the delay, Joel.
>
> Yes, please apply.
Thank you, applied. (and no worries for the delay, a delay of a week
or even two weeks is perfectly acceptable to me)
--
Joel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] Pb stepping inside DLL function
2004-06-24 0:22 [RFA] Pb stepping inside DLL function Joel Brobecker
2004-06-24 0:23 ` Joel Brobecker
@ 2004-06-24 0:27 ` Michael Snyder
1 sibling, 0 replies; 5+ messages in thread
From: Michael Snyder @ 2004-06-24 0:27 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
Joel, did you forget to attach the patch? ;-)
Joel Brobecker wrote:
> Hello,
>
> We have the following little C program (a.c):
>
> #include <stdio.h>
>
> extern _stdcall int sub ();
>
> main ()
> {
> int a = 0;
>
> a = sub ();
> printf ("%d\n", a);
> }
>
> ``sub()'' is a function provided by a DLL. It has all the necessary
> debug information. The following transcript shows that GDB is currently
> unable to step into sub():
>
> (gdb) start
> Breakpoint 1 at 0x4012d2: file a.c, line 7.
> Starting program: /[...]/a.exe
> main () at a.c:7
> 7 int a = 0;
> (gdb) step
> 9 a = sub ();
> (gdb) p a
> $1 = 0
> (gdb) step
> 10 printf ("%d\n", a);
> (gdb) print a
> $2 = 5
>
> During the step, GDB lands inside sub@0, which is the trampoline
> for sub(), but doesn't realize it. The fix is to teach GDB how to
> recognize them, and hand to find where they will eventually take us.
> For that, I found a function that was actually dead but did exactly
> what I needed, so I reused it.
>
> 2004-06-23 Joel Brobecker <brobecker@gnat.com>
>
> * i386-cygwin-tdep.c (i386-cygwin-tdep.c): New function.
> (i386_cygwin_in_solib_call_trampoline): New function.
> (i386_cygwin_init_abi): Initialize the in_solib_call_trampoline
> and skip_trampoline_code gdbarch methods.
>
> Tested on x86-windows (XP), no regression.
> OK to apply?
>
> Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-06-29 18:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-24 0:22 [RFA] Pb stepping inside DLL function Joel Brobecker
2004-06-24 0:23 ` Joel Brobecker
2004-06-29 14:35 ` Christopher Faylor
2004-06-29 18:18 ` Joel Brobecker
2004-06-24 0:27 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox