dbghelp: Introduce symt_find_symbol_at().
commit99c78180979b32678bbd9395d00739108d73a87a
authorEric Pouech <eric.pouech@gmail.com>
Fri, 29 Apr 2022 09:08:31 +0000 (29 11:08 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Wed, 4 May 2022 19:27:25 +0000 (4 21:27 +0200)
tree87a71ad4372c66e3943e77ab64afccd03abf1cb2
parentd106b3c450cfa4af2a9fbcca4c640536ebd34bc3
dbghelp: Introduce symt_find_symbol_at().

To be used in place of symt_find_nearest().
symt_find_symbol_at() ensures that the address passed is within the
boundaries of the returned symbol (while find_nearest() doesn't).

This fixes erroneous backtraces in debugger like:
$ ./wine winedbg notepad
WineDbg starting on pid 0104
RtlDefaultNpAcl () at Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731
0x00000170054805 ntdll+0x54805 [Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731]: ret
1731    }
Wine-dbg>bt
Backtrace:
=>0 0x00000170054805 RtlDefaultNpAcl+0x2d5(pAcl=<internal error>) [Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731] in ntdll (0x000001700701a4)
  1 0x0000017002d6c4 __wine_pop_frame(pAcl=<internal error>) [Z:\home\eric\work\wine\include\wine\exception.h:273] in ntdll (0x000001700701a4)
  2 0x0000017002d6c4 process_breakpoint+0x84() [Z:\home\eric\work\wine\dlls\ntdll\loader.c:3912] in ntdll (0x000001700701a4)
  3 0x000001700354c9 LdrInitializeThunk+0x509(context=<register R13 not accessible in this frame>, unknown2=<internal error>, unknown3=<internal error>, unknown4=<internal error>) [Z:\home\eric\work\wine\dlls\ntdll\loader.c:4200] in ntdll (0x000001700701a4)

where RtlDefaultNpAcl() has nothing to do here (it's the symbol below RIP
and we don't have a symbol with debug information for that address).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
dlls/dbghelp/dbghelp.c
dlls/dbghelp/dbghelp_private.h
dlls/dbghelp/dwarf.c
dlls/dbghelp/msc.c
dlls/dbghelp/symbol.c