Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@linaro.org>
To: Ruslan Kabatsayev <b7.10110111@gmail.com>
Cc: gdb@gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: How to set a breakpoint on imported Win32 function?
Date: Thu, 16 Jan 2020 18:14:00 -0000	[thread overview]
Message-ID: <98c5e02a-9310-268d-3a0f-abe71b2dd47f@linaro.org> (raw)
In-Reply-To: <CAHEcG96ZcRV+3JMvpVeEcVFAdpz2Jbep+ab+3N0WVq73cJQwqA@mail.gmail.com>

On 1/16/20 2:16 PM, Ruslan Kabatsayev wrote:
> On Thu, 16 Jan 2020 at 17:53, Luis Machado <luis.machado@linaro.org> wrote:
>>
>> On 1/15/20 7:42 PM, Ruslan Kabatsayev wrote:
>>> Hello,
>>>
>>> I have a program without any debug info, which has an import table
>>> with some functions imported by name. E.g. kernel32!ExitProcess is
>>> imported, and the debugger should know its name and address.
>>>
>>> But whenever I run GDB (from mingw-w64) with my test exe and try to
>>> set breakpoint on ExitProcess, GDB complains that no symbol table is
>>> loaded and asks if I want it set on future library load. After I agree
>>> and let the debuggee run, the debuggee exits without any trap
>>> (although it does exit via this exact function).
>>>
>>> OTOH, on Linux I can set a breakpoint on e.g. exit, which gets located
>>> in /lib/i386-linux-gnu/libc.so.6 for which I don't have any debug
>>> symbols, and the breakpoint successfully traps.
>>>
>>> So, how can I set a breakpoint on an imported function in Windows? Or
>>> is the handling of PE import table to fill GDB's symbol table not
>>> implemented?
>>>
>>> Thanks,
>>> Ruslan
>>>
>>
>> Given what you described, i think GDB doesn't know how to properly
>> locate that symbol. Can you at least see the symbol somewhere, in
>> disassemble output for example?
> 
> No, apparently GDB doesn't indeed know about this symbol. The
> disassembly (both at the call site and in the function itself) simply
> shows the address, without any hints about symbols.
> Has this ever worked on Windows GDB? Or was it simply not implemented?
> 

I'm not well versed in GDB on Windows, so i'm not so sure. It could be both.

I've cc-ed Eli, who tends to touch more mingw stuff.


  reply	other threads:[~2020-01-16 18:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 22:42 Ruslan Kabatsayev
2020-01-16 14:54 ` Luis Machado
2020-01-16 17:17   ` Ruslan Kabatsayev
2020-01-16 18:14     ` Luis Machado [this message]
2020-01-16 18:28       ` Eli Zaretskii
2020-01-16 20:01         ` Ruslan Kabatsayev
2020-01-17  7:46           ` Eli Zaretskii
2020-01-17  8:41             ` Ruslan Kabatsayev

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=98c5e02a-9310-268d-3a0f-abe71b2dd47f@linaro.org \
    --to=luis.machado@linaro.org \
    --cc=b7.10110111@gmail.com \
    --cc=eliz@gnu.org \
    --cc=gdb@gnu.org \
    /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