How to set a breakpoint on imported Win32 function?
Eli Zaretskii
eliz@gnu.org
Fri Jan 17 07:46:00 GMT 2020
> From: Ruslan Kabatsayev <b7.10110111@gmail.com>
> Date: Thu, 16 Jan 2020 23:00:04 +0300
> Cc: Luis Machado <luis.machado@linaro.org>, gdb@gnu.org
>
> > If I start a MinGW program under GDB, and then put a breakpoint on
> > ExitProcess, I get this:
> >
> > Temporary breakpoint 2, main (argc=2, argv=0xa42848) at emacs.c:934
> > 934 bool no_loadup = false;
> > (gdb) break ExitProcess
> > Breakpoint 3 at 0x7c81bfa7
> > (gdb) info breakpoints
> > Num Type Disp Enb Address What
> > 3 breakpoint keep y 0x7c81bfa7 <KERNEL32!ExitProcess+5>
> >
> > So it seems that GDB already knows how to put breakpoints on such
> > functions: you just need to name them without the DLL-name part.
> > However, I'm not sure I understand what is meant above by "functions
> > imported by name". How exactly were they imported? Does the above
> > technique work for you?
>
> They were imported as named functions usually are, i.e. not by
> ordinal. I just said this to emphasize that GDB should be able to find
> these symbols.
Doesn't the fact that "break ExitProcess" works mean GDB _is_ able to
find the symbol? Maybe I'm missing something, but I always considered
the "KERNEL32!" part some kind of decoration, not really part of the
symbol.
More information about the Gdb
mailing list