Re: How to set a breakpoint on imported Win32 function?
Eli Zaretskii <[email protected]> Fri, 17 Jan 2020 09:46:09 +0200
| Newsgroups | gmane.comp.gdb.devel,gmane.comp.gdb.general |
|---|---|
| Message-ID | <[email protected]> |
> From: Ruslan Kabatsayev <[email protected]> > Date: Thu, 16 Jan 2020 23:00:04 +0300 > Cc: Luis Machado <[email protected]>, [email protected] > > > 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.