]> git.sesse.net Git - vlc/commitdiff
winvlc: include address space layout in crash reports
authorRafaël Carré <funman@videolan.org>
Tue, 15 Nov 2011 01:22:21 +0000 (20:22 -0500)
committerRafaël Carré <funman@videolan.org>
Tue, 15 Nov 2011 01:22:21 +0000 (20:22 -0500)
Will help to 'undo' ASLR and make those reports useful

bin/Makefile.am
bin/winvlc.c

index 86d7f65596e39a5e12f8fe22340af8f4612fb570..832d4825c1bb64e817e900bc61b217c2f7a789fc 100644 (file)
@@ -45,7 +45,7 @@ vlc_static_LDADD = $(vlc_LDADD)
 vlc_static_LDFLAGS = $(vlc_LDFLAGS)
 
 if HAVE_WIN32
-vlc_LDADD += -lwininet vlc_win32_rc.$(OBJEXT)
+vlc_LDADD += -lpsapi -lwininet vlc_win32_rc.$(OBJEXT)
 vlc_DEPENDENCIES = vlc_win32_rc.$(OBJEXT)
 else
 vlc_LDADD += $(LIBDL)
index b3ef7983db5235d19f0f0fca7cb86324c5ae53c0..1f60123dec3afbd07840854288200ba7906c1acf 100644 (file)
@@ -38,6 +38,8 @@
 # endif
 # include <shlobj.h>
 # include <wininet.h>
+# define PSAPI_VERSION 1
+# include <psapi.h>
 # define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1
 static void check_crashdump(void);
 LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo);
@@ -343,6 +345,23 @@ LONG WINAPI vlc_exception_filter(struct _EXCEPTION_POINTERS *lpExceptionInfo)
                         pContext->Ebp,pContext->Eip,pContext->Esp );
 #endif
 
+        HANDLE hpid = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+                                        FALSE, GetCurrentProcessId());
+        if (hpid) {
+            HMODULE mods[1024];
+            DWORD size;
+            if (EnumProcessModules(hpid, mods, sizeof(mods), &size)) {
+                fwprintf( fd, L"\n\n[modules]\n" );
+                for (unsigned int i = 0; i < size / sizeof(HMODULE); i++) {
+                    wchar_t module[ 256 ];
+                    GetModuleFileName(mods[i], module, 256);
+                    fwprintf( fd, L"%p|%s\n", mods[i], module);
+                }
+            }
+            CloseHandle(hpid);
+        }
+
+
         fwprintf( fd, L"\n[stacktrace]\n#EIP|base|module\n" );
 
 #ifdef WIN64