Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Pb stepping inside DLL function
Date: Thu, 24 Jun 2004 00:22:00 -0000	[thread overview]
Message-ID: <20040624002220.GK1143@gnat.com> (raw)

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


             reply	other threads:[~2004-06-24  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-24  0:22 Joel Brobecker [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040624002220.GK1143@gnat.com \
    --to=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox