Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
3ace88ec
Commit
3ace88ec
authored
Apr 27, 2009
by
Geoffroy Couprie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: generate crashdumps everytime except if a debugger is present
parent
7986cb4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
62 deletions
+70
-62
bin/winvlc.c
bin/winvlc.c
+70
-62
No files found.
bin/winvlc.c
View file @
3ace88ec
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include <stdlib.h>
#include <stdlib.h>
#include <windows.h>
#include <windows.h>
#if !defined(UNDER_CE)
&& defined ( NDEBUG )
#if !defined(UNDER_CE)
# define _WIN32_IE 0x500
# define _WIN32_IE 0x500
# include <shlobj.h>
# include <shlobj.h>
# include <tlhelp32.h>
# include <tlhelp32.h>
...
@@ -137,7 +137,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
...
@@ -137,7 +137,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
dummy
);
libvlc_exception_init
(
&
dummy
);
#if !defined( UNDER_CE )
&& defined ( NDEBUG )
#if !defined( UNDER_CE )
check_crashdump
();
check_crashdump
();
SetUnhandledExceptionFilter
(
vlc_exception_filter
);
SetUnhandledExceptionFilter
(
vlc_exception_filter
);
#endif
#endif
...
@@ -164,7 +164,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
...
@@ -164,7 +164,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
return
ret
;
return
ret
;
}
}
#if !defined( UNDER_CE )
&& defined ( NDEBUG )
#if !defined( UNDER_CE )
static
void
get_crashdump_path
(
wchar_t
*
wdir
)
static
void
get_crashdump_path
(
wchar_t
*
wdir
)
{
{
...
@@ -223,74 +223,82 @@ static void check_crashdump()
...
@@ -223,74 +223,82 @@ static void check_crashdump()
*****************************************************************************/
*****************************************************************************/
LONG
WINAPI
vlc_exception_filter
(
struct
_EXCEPTION_POINTERS
*
lpExceptionInfo
)
LONG
WINAPI
vlc_exception_filter
(
struct
_EXCEPTION_POINTERS
*
lpExceptionInfo
)
{
{
fprintf
(
stderr
,
"unhandled vlc exception
\n
"
);
if
(
IsDebuggerPresent
())
wchar_t
*
wdir
=
(
wchar_t
*
)
malloc
(
sizeof
(
wchar_t
)
*
MAX_PATH
);
get_crashdump_path
(
wdir
);
FILE
*
fd
=
_wfopen
(
wdir
,
L"w, ccs=UTF-8"
);
free
((
void
*
)
wdir
);
if
(
!
fd
)
{
{
fprintf
(
stderr
,
"
\n
error while opening file"
);
//If a debugger is present, pass the exception to the debugger with EXCEPTION_CONTINUE_SEARCH
exit
(
1
)
;
return
EXCEPTION_CONTINUE_SEARCH
;
}
}
else
OSVERSIONINFO
osvi
;
ZeroMemory
(
&
osvi
,
sizeof
(
OSVERSIONINFO
)
);
osvi
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFO
);
GetVersionEx
(
&
osvi
);
fwprintf
(
fd
,
L"[version]
\n
OS=%d.%d.%d.%d.%s
\n
VLC="
VERSION_MESSAGE
,
osvi
.
dwMajorVersion
,
osvi
.
dwMinorVersion
,
osvi
.
dwBuildNumber
,
osvi
.
dwPlatformId
,
osvi
.
szCSDVersion
);
const
CONTEXT
*
const
pContext
=
(
const
CONTEXT
*
)
lpExceptionInfo
->
ContextRecord
;
const
EXCEPTION_RECORD
*
const
pException
=
(
const
EXCEPTION_RECORD
*
)
lpExceptionInfo
->
ExceptionRecord
;
/*No nested exceptions for now*/
fwprintf
(
fd
,
L"
\n\n
[exceptions]
\n
%08x at %08x"
,
pException
->
ExceptionCode
,
pException
->
ExceptionAddress
);
if
(
pException
->
NumberParameters
>
0
)
{
{
unsigned
int
i
;
fprintf
(
stderr
,
"unhandled vlc exception
\n
"
);
for
(
i
=
0
;
i
<
pException
->
NumberParameters
;
i
++
)
fprintf
(
fd
,
" | %08x"
,
pException
->
ExceptionInformation
[
i
]
);
}
fwprintf
(
fd
,
L"
\n\n
[context]
\n
EDI:%08x
\n
ESI:%08x
\n
"
\
wchar_t
*
wdir
=
(
wchar_t
*
)
malloc
(
sizeof
(
wchar_t
)
*
MAX_PATH
);
"EBX:%08x
\n
EDX:%08x
\n
ECX:%08x
\n
EAX:%08x
\n
"
\
get_crashdump_path
(
wdir
);
"EBP:%08x
\n
EIP:%08x
\n
ESP:%08x
\n
"
,
FILE
*
fd
=
_wfopen
(
wdir
,
L"w, ccs=UTF-8"
);
pContext
->
Edi
,
pContext
->
Esi
,
pContext
->
Ebx
,
free
((
void
*
)
wdir
);
pContext
->
Edx
,
pContext
->
Ecx
,
pContext
->
Eax
,
pContext
->
Ebp
,
pContext
->
Eip
,
pContext
->
Esp
);
if
(
!
fd
)
{
fprintf
(
stderr
,
"
\n
error while opening file"
);
exit
(
1
);
}
fwprintf
(
fd
,
L"
\n
[stacktrace]
\n
#EIP|base|module
\n
"
);
OSVERSIONINFO
osvi
;
ZeroMemory
(
&
osvi
,
sizeof
(
OSVERSIONINFO
)
);
osvi
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFO
);
GetVersionEx
(
&
osvi
);
fwprintf
(
fd
,
L"[version]
\n
OS=%d.%d.%d.%d.%s
\n
VLC="
VERSION_MESSAGE
,
osvi
.
dwMajorVersion
,
osvi
.
dwMinorVersion
,
osvi
.
dwBuildNumber
,
osvi
.
dwPlatformId
,
osvi
.
szCSDVersion
);
const
CONTEXT
*
const
pContext
=
(
const
CONTEXT
*
)
lpExceptionInfo
->
ContextRecord
;
const
EXCEPTION_RECORD
*
const
pException
=
(
const
EXCEPTION_RECORD
*
)
lpExceptionInfo
->
ExceptionRecord
;
/*No nested exceptions for now*/
fwprintf
(
fd
,
L"
\n\n
[exceptions]
\n
%08x at %08x"
,
pException
->
ExceptionCode
,
pException
->
ExceptionAddress
);
if
(
pException
->
NumberParameters
>
0
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
pException
->
NumberParameters
;
i
++
)
fprintf
(
fd
,
" | %08x"
,
pException
->
ExceptionInformation
[
i
]
);
}
wchar_t
module
[
256
];
fwprintf
(
fd
,
L"
\n\n
[context]
\n
EDI:%08x
\n
ESI:%08x
\n
"
\
MEMORY_BASIC_INFORMATION
mbi
;
"EBX:%08x
\n
EDX:%08x
\n
ECX:%08x
\n
EAX:%08x
\n
"
\
VirtualQuery
(
(
DWORD
*
)
pContext
->
Eip
,
&
mbi
,
sizeof
(
mbi
)
)
;
"EBP:%08x
\n
EIP:%08x
\n
ESP:%08x
\n
"
,
HINSTANCE
hInstance
=
mbi
.
AllocationBase
;
pContext
->
Edi
,
pContext
->
Esi
,
pContext
->
Ebx
,
GetModuleFileName
(
hInstance
,
module
,
256
)
;
pContext
->
Edx
,
pContext
->
Ecx
,
pContext
->
Eax
,
fwprintf
(
fd
,
L"%08x|%s
\n
"
,
pContext
->
Eip
,
module
);
pContext
->
Ebp
,
pContext
->
Eip
,
pContext
->
Esp
);
DWORD
pEbp
=
pContext
->
Ebp
;
fwprintf
(
fd
,
L"
\n
[stacktrace]
\n
#EIP|base|module
\n
"
);
DWORD
caller
=
*
((
DWORD
*
)
pEbp
+
1
);
do
wchar_t
module
[
256
];
{
MEMORY_BASIC_INFORMATION
mbi
;
VirtualQuery
(
(
DWORD
*
)
caller
,
&
mbi
,
sizeof
(
mbi
)
)
;
VirtualQuery
(
(
DWORD
*
)
pContext
->
Eip
,
&
mbi
,
sizeof
(
mbi
)
)
;
HINSTANCE
hInstance
=
mbi
.
AllocationBase
;
HINSTANCE
hInstance
=
mbi
.
AllocationBase
;
GetModuleFileName
(
hInstance
,
module
,
256
)
;
GetModuleFileName
(
hInstance
,
module
,
256
)
;
fwprintf
(
fd
,
L"%08x|%s
\n
"
,
caller
,
module
);
fwprintf
(
fd
,
L"%08x|%s
\n
"
,
pContext
->
Eip
,
module
);
pEbp
=
*
(
DWORD
*
)
pEbp
;
caller
=
*
((
DWORD
*
)
pEbp
+
1
)
;
DWORD
pEbp
=
pContext
->
Ebp
;
/*The last EBP points to NULL!*/
DWORD
caller
=
*
((
DWORD
*
)
pEbp
+
1
);
}
while
(
caller
);
do
fclose
(
fd
);
{
fflush
(
stderr
);
VirtualQuery
(
(
DWORD
*
)
caller
,
&
mbi
,
sizeof
(
mbi
)
)
;
exit
(
1
);
HINSTANCE
hInstance
=
mbi
.
AllocationBase
;
GetModuleFileName
(
hInstance
,
module
,
256
)
;
fwprintf
(
fd
,
L"%08x|%s
\n
"
,
caller
,
module
);
pEbp
=
*
(
DWORD
*
)
pEbp
;
caller
=
*
((
DWORD
*
)
pEbp
+
1
)
;
/*The last EBP points to NULL!*/
}
while
(
caller
);
fclose
(
fd
);
fflush
(
stderr
);
exit
(
1
);
}
}
}
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment