mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 22:26:06 +00:00
Stop providing unimplemented stubs for util/mach/exc_server_variants.cc.
Rather than providing these stubs to make the linker happy, use the mig.py script to modify the _Xserver_routine functions to not even call server_routine. Change-Id: I5a2f5cd228462e38dddbf899d0ad8033a6f817bd Reviewed-on: https://chromium-review.googlesource.com/773359 Commit-Queue: Robert Sesek <rsesek@chromium.org> Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
d7798a4e28
commit
6dd2be7c44
@ -30,98 +30,6 @@
|
||||
#include "util/mach/mach_excServer.h"
|
||||
#include "util/mach/mach_message.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
// These six functions are not used, and are in fact obsoleted by the other
|
||||
// functionality implemented in this file. The standard MIG-generated exc_server
|
||||
// (in excServer.c) and mach_exc_server (in mach_excServer.c) server dispatch
|
||||
// routines usable with the standard mach_msg_server() function call out to
|
||||
// these functions. exc_server() and mach_exc_server() are unused and are
|
||||
// replaced by the more flexible ExcServer and MachExcServer, but the linker
|
||||
// still needs to see these six function definitions.
|
||||
|
||||
kern_return_t catch_exception_raise(exception_handler_t exception_port,
|
||||
thread_t thread,
|
||||
task_t task,
|
||||
exception_type_t exception,
|
||||
exception_data_t code,
|
||||
mach_msg_type_number_t code_count) {
|
||||
NOTREACHED();
|
||||
return KERN_FAILURE;
|
||||
}
|
||||
|
||||
kern_return_t catch_exception_raise_state(
|
||||
exception_handler_t exception_port,
|
||||
exception_type_t exception,
|
||||
exception_data_t code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
thread_state_t old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count) {
|
||||
NOTREACHED();
|
||||
return KERN_FAILURE;
|
||||
}
|
||||
|
||||
kern_return_t catch_exception_raise_state_identity(
|
||||
exception_handler_t exception_port,
|
||||
thread_t thread,
|
||||
task_t task,
|
||||
exception_type_t exception,
|
||||
exception_data_t code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
thread_state_t old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count) {
|
||||
NOTREACHED();
|
||||
return KERN_FAILURE;
|
||||
}
|
||||
|
||||
kern_return_t catch_mach_exception_raise(exception_handler_t exception_port,
|
||||
thread_t thread,
|
||||
task_t task,
|
||||
exception_type_t exception,
|
||||
mach_exception_data_t code,
|
||||
mach_msg_type_number_t code_count) {
|
||||
NOTREACHED();
|
||||
return KERN_FAILURE;
|
||||
}
|
||||
|
||||
kern_return_t catch_mach_exception_raise_state(
|
||||
exception_handler_t exception_port,
|
||||
exception_type_t exception,
|
||||
mach_exception_data_t code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
thread_state_t old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count) {
|
||||
NOTREACHED();
|
||||
return KERN_FAILURE;
|
||||
}
|
||||
|
||||
kern_return_t catch_mach_exception_raise_state_identity(
|
||||
exception_handler_t exception_port,
|
||||
thread_t thread,
|
||||
task_t task,
|
||||
exception_type_t exception,
|
||||
mach_exception_data_t code,
|
||||
mach_msg_type_number_t code_count,
|
||||
thread_state_flavor_t* flavor,
|
||||
thread_state_t old_state,
|
||||
mach_msg_type_number_t old_state_count,
|
||||
thread_state_t new_state,
|
||||
mach_msg_type_number_t* new_state_count) {
|
||||
NOTREACHED();
|
||||
return KERN_FAILURE;
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
namespace crashpad {
|
||||
|
||||
namespace {
|
||||
|
@ -73,6 +73,18 @@ def FixServerImplementation(implementation):
|
||||
# Rewrite the declarations in this file as “mig_external”.
|
||||
contents = declaration_pattern.sub(r'mig_external \1', contents);
|
||||
|
||||
# Crashpad never implements the mach_msg_server() MIG callouts. To avoid
|
||||
# needing to provide stub implementations, set KERN_FAILURE as the RetCode
|
||||
# and abort().
|
||||
routine_callout_pattern = re.compile(
|
||||
r'OutP->RetCode = (([a-zA-Z0-9_]+)\(.+\));')
|
||||
routine_callouts = routine_callout_pattern.findall(contents)
|
||||
for routine in routine_callouts:
|
||||
contents = contents.replace(routine[0], 'KERN_FAILURE; abort()')
|
||||
|
||||
# Include the header for abort().
|
||||
contents = '#include <stdlib.h>\n' + contents
|
||||
|
||||
file.seek(0)
|
||||
file.truncate()
|
||||
file.write(contents)
|
||||
|
Loading…
x
Reference in New Issue
Block a user