From 08c7ff99e13890ed19b864e7ebfea7167eb83842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 28 Oct 2019 10:11:05 +0200 Subject: [PATCH] [libunwind] [Windows] Add a log message if EnumProcessModules fails Differential Revision: https://reviews.llvm.org/D69504 --- libunwind/src/AddressSpace.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libunwind/src/AddressSpace.hpp b/libunwind/src/AddressSpace.hpp index 908c898d7403..db67df4dc80a 100644 --- a/libunwind/src/AddressSpace.hpp +++ b/libunwind/src/AddressSpace.hpp @@ -433,8 +433,12 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr, HANDLE process = GetCurrentProcess(); DWORD needed; - if (!EnumProcessModules(process, mods, sizeof(mods), &needed)) + if (!EnumProcessModules(process, mods, sizeof(mods), &needed)) { + DWORD err = GetLastError(); + _LIBUNWIND_TRACE_UNWINDING("findUnwindSections: EnumProcessModules failed, " + "returned error %d", (int)err); return false; + } for (unsigned i = 0; i < (needed / sizeof(HMODULE)); i++) { PIMAGE_DOS_HEADER pidh = (PIMAGE_DOS_HEADER)mods[i];