[newlib-cygwin] Cygwin: Handle out of order modules for module offsets in stackdump
Jon TURNEY
jturney@sourceware.org
Fri Nov 4 15:11:31 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=564c88b89833d711281f7b5dd2b74b453dc66ea9
commit 564c88b89833d711281f7b5dd2b74b453dc66ea9
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Tue Nov 1 14:01:08 2022 +0000
Cygwin: Handle out of order modules for module offsets in stackdump
Improve address to module+offset conversion, to work correctly in the
presence of out-of-order elements in InMemoryOrderModuleList.
Fixes: d59651d4
Diff:
---
winsup/cygwin/exceptions.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 8cc454c90..c3433ab94 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -342,11 +342,13 @@ prettyprint_va (PVOID func_va)
{
PLDR_DATA_TABLE_ENTRY mod = CONTAINING_RECORD (x, LDR_DATA_TABLE_ENTRY,
InMemoryOrderLinks);
- if (mod->DllBase > func_va)
+ if ((func_va < mod->DllBase) ||
+ (func_va > (PVOID)((DWORD_PTR)mod->DllBase + mod->SizeOfImage)))
continue;
__small_sprintf (buf, "%S+0x%x", &mod->BaseDllName,
(DWORD_PTR)func_va - (DWORD_PTR)mod->DllBase);
+ break;
}
return buf;
More information about the Cygwin-cvs
mailing list