Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
f7c9acae
Commit
f7c9acae
authored
Feb 01, 2009
by
Geoffroy Couprie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: generate stacktrace on unhandled exception
parent
32304511
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
bin/winvlc.c
bin/winvlc.c
+89
-0
No files found.
bin/winvlc.c
View file @
f7c9acae
...
...
@@ -35,6 +35,13 @@
#include <stdlib.h>
#include <windows.h>
#if !defined(UNDER_CE) && defined ( NDEBUG )
# define _WIN32_IE 0x500
# include <shlobj.h>
# include <tlhelp32.h>
LONG
WINAPI
vlc_exception_filter
(
struct
_EXCEPTION_POINTERS
*
lpExceptionInfo
);
#endif
#ifndef UNDER_CE
static
char
*
FromWide
(
const
wchar_t
*
wide
)
{
...
...
@@ -128,6 +135,10 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
dummy
);
#if !defined( UNDER_CE ) && defined ( NDEBUG )
SetUnhandledExceptionFilter
(
vlc_exception_filter
);
#endif
/* Initialize libvlc */
libvlc_instance_t
*
vlc
;
vlc
=
libvlc_new
(
argc
-
1
,
(
const
char
**
)
argv
+
1
,
&
ex
);
...
...
@@ -149,3 +160,81 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
(
void
)
hInstance
;
(
void
)
hPrevInstance
;
(
void
)
lpCmdLine
;
(
void
)
nCmdShow
;
return
ret
;
}
#if !defined( UNDER_CE ) && defined ( NDEBUG )
/*****************************************************************************
* vlc_exception_filter: handles unhandled exceptions, like segfaults
*****************************************************************************/
LONG
WINAPI
vlc_exception_filter
(
struct
_EXCEPTION_POINTERS
*
lpExceptionInfo
)
{
wchar_t
wdir
[
MAX_PATH
];
fprintf
(
stderr
,
"unhandled vlc exception
\n
"
);
if
(
S_OK
!=
SHGetFolderPathW
(
NULL
,
CSIDL_APPDATA
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_CURRENT
,
wdir
)
)
fprintf
(
stderr
,
"Can't open the vlc conf PATH
\n
"
);
swprintf
(
wdir
+
wcslen
(
wdir
),
L"%s"
,
L"
\\
vlc
\\
crashdump"
);
FILE
*
fd
=
_wfopen
(
wdir
,
L"w, ccs=UTF-8"
);
if
(
!
fd
)
fprintf
(
stderr
,
"
\n
error while opening file"
);
OSVERSIONINFO
osvi
;
ZeroMemory
(
&
osvi
,
sizeof
(
OSVERSIONINFO
)
);
osvi
.
dwOSVersionInfoSize
=
sizeof
(
OSVERSIONINFO
);
GetVersionEx
(
&
osvi
);
fwprintf
(
fd
,
L"[Version]
\n
0S=%d.%d.%d.%d.%s
\n
VLC=%s"
,
osvi
.
dwMajorVersion
,
osvi
.
dwMinorVersion
,
osvi
.
dwBuildNumber
,
osvi
.
dwPlatformId
,
osvi
.
szCSDVersion
,
VERSION_MESSAGE
);
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
]
);
}
fwprintf
(
fd
,
L"
\n\n
[CONTEXT]
\n
EDI:%08x
\n
ESI:%08x
\n
"
\
"EBX:%08x
\n
EDX:%08xn
\n
ECX:%08x
\n
EAX:%08x
\n
"
\
"EBP:%08x
\n
EIP:%08x
\n
ESP:%08x
\n
"
,
pContext
->
Edi
,
pContext
->
Esi
,
pContext
->
Ebx
,
pContext
->
Edx
,
pContext
->
Ecx
,
pContext
->
Eax
,
pContext
->
Ebp
,
pContext
->
Eip
,
pContext
->
Esp
);
fwprintf
(
fd
,
L"
\n\n
[STACKTRACE]
\n
#EIP|base|module
\n
"
);
DWORD
pEbp
=
pContext
->
Ebp
;
DWORD
caller
=
*
((
DWORD
*
)
pEbp
+
1
)
;
wchar_t
module
[
256
];
do
{
MEMORY_BASIC_INFORMATION
mbi
;
VirtualQuery
(
(
DWORD
*
)
caller
,
&
mbi
,
sizeof
(
mbi
)
)
;
HINSTANCE
hInstance
=
mbi
.
AllocationBase
;
GetModuleFileName
(
hInstance
,
module
,
256
)
;
fwprintf
(
fd
,
L"%08x|%08x|%s
\n
"
,
caller
,
hInstance
,
module
);
pEbp
=
*
(
DWORD
*
)
pEbp
;
caller
=
*
((
DWORD
*
)
pEbp
+
1
)
;
/*The last EBP points to NULL!*/
}
while
(
caller
);
fclose
(
fd
);
fflush
(
stderr
);
exit
(
1
);
}
#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