Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
02ee9dda
Commit
02ee9dda
authored
Apr 13, 2000
by
Eric Pouech
Committed by
Alexandre Julliard
Apr 13, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added launching of a debugger when unhandled exception occurs.
parent
87031a4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
7 deletions
+70
-7
except.c
win32/except.c
+61
-7
winedefault.reg
winedefault.reg
+9
-0
No files found.
win32/except.c
View file @
02ee9dda
...
...
@@ -72,8 +72,12 @@ void WINAPI RaiseException( DWORD code, DWORD flags, DWORD nbargs, const LPDWORD
DWORD
WINAPI
UnhandledExceptionFilter
(
PEXCEPTION_POINTERS
epointers
)
{
struct
exception_event_request
*
req
=
get_req_buffer
();
char
message
[
80
];
PDB
*
pdb
=
PROCESS_Current
();
PDB
*
pdb
=
PROCESS_Current
();
char
format
[
256
];
char
buffer
[
256
];
HKEY
hDbgConf
;
DWORD
bAuto
;
DWORD
ret
=
EXCEPTION_EXECUTE_HANDLER
;
/* send a last chance event to the debugger */
req
->
record
=
*
epointers
->
ExceptionRecord
;
...
...
@@ -90,11 +94,61 @@ DWORD WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS epointers)
/* FIXME: Should check the current error mode */
sprintf
(
message
,
"Unhandled exception 0x%08lx at address 0x%08lx."
,
epointers
->
ExceptionRecord
->
ExceptionCode
,
(
DWORD
)
epointers
->
ExceptionRecord
->
ExceptionAddress
);
Callout
.
MessageBoxA
(
0
,
message
,
"Error"
,
MB_OK
|
MB_ICONHAND
);
return
EXCEPTION_EXECUTE_HANDLER
;
if
(
!
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows NT
\\
CurrentVersion
\\
AeDebug"
,
&
hDbgConf
))
{
DWORD
type
;
DWORD
count
;
count
=
sizeof
(
format
);
if
(
RegQueryValueExA
(
hDbgConf
,
"Debugger"
,
0
,
&
type
,
format
,
&
count
))
format
[
0
]
=
0
;
count
=
sizeof
(
bAuto
);
if
(
RegQueryValueExA
(
hDbgConf
,
"Auto"
,
0
,
&
type
,
(
char
*
)
&
bAuto
,
&
count
))
bAuto
=
FALSE
;
RegCloseKey
(
hDbgConf
);
}
else
{
format
[
0
]
=
0
;
}
if
(
!
bAuto
)
{
sprintf
(
buffer
,
"Unhandled exception 0x%08lx at address 0x%08lx.
\n
"
"Do you wish to debug it ?"
,
epointers
->
ExceptionRecord
->
ExceptionCode
,
(
DWORD
)
epointers
->
ExceptionRecord
->
ExceptionAddress
);
if
(
Callout
.
MessageBoxA
(
0
,
buffer
,
"Error"
,
MB_YESNO
|
MB_ICONHAND
)
==
IDNO
)
{
TRACE
(
"Killing process
\n
"
);
return
EXCEPTION_EXECUTE_HANDLER
;
}
}
if
(
format
[
0
])
{
HANDLE
hEvent
;
PROCESS_INFORMATION
info
;
STARTUPINFOA
startup
;
TRACE
(
"Starting debugger (fmt=%s)
\n
"
,
format
);
hEvent
=
ConvertToGlobalHandle
(
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
));
sprintf
(
buffer
,
format
,
(
unsigned
long
)
pdb
->
server_pid
,
hEvent
);
memset
(
&
startup
,
0
,
sizeof
(
startup
));
startup
.
cb
=
sizeof
(
startup
);
startup
.
dwFlags
=
STARTF_USESHOWWINDOW
;
startup
.
wShowWindow
=
SW_SHOWNORMAL
;
if
(
CreateProcessA
(
NULL
,
buffer
,
NULL
,
NULL
,
TRUE
,
0
,
NULL
,
NULL
,
&
startup
,
&
info
))
{
WaitForSingleObject
(
hEvent
,
INFINITE
);
ret
=
EXCEPTION_CONTINUE_SEARCH
;
}
else
{
ERR
(
"Couldn't start debugger (%s)
\n
"
,
buffer
);
}
CloseHandle
(
hEvent
);
}
else
{
ERR
(
"No standard debugger defined in the registry => no debugging session
\n
"
);
}
return
ret
;
}
...
...
winedefault.reg
View file @
02ee9dda
...
...
@@ -58,6 +58,15 @@
"ProgramFilesDir"="C:\Program Files"
#
# Configuration for unhandled exceptions
#
[MACHINE\Software\Microsoft\Windows NT\CurrentVersionAeDebug]
# command line to start a debugger when an exception occurs
"Debugger"="debugger/winedbg %ld %ld"
# to 1 if no message box has to be presented before running the debugger
"Auto"=dword:00000000
#
# This identifies the files for available code pages
#
...
...
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