mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-09-03 12:11:05 +00:00
Fix linux compile errors for some systems.
Codereview: https://breakpad.appspot.com/460002/ Patch by: jakerr@google.com git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1055 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
47d9afa176
commit
a56db25fed
|
@ -37,7 +37,7 @@ class CrashGenerationServer;
|
||||||
class ClientInfo {
|
class ClientInfo {
|
||||||
public:
|
public:
|
||||||
ClientInfo(pid_t pid, CrashGenerationServer* crash_server)
|
ClientInfo(pid_t pid, CrashGenerationServer* crash_server)
|
||||||
: crash_server_(crash_server_),
|
: crash_server_(crash_server),
|
||||||
pid_(pid) {}
|
pid_(pid) {}
|
||||||
|
|
||||||
CrashGenerationServer* crash_server() const { return crash_server_; }
|
CrashGenerationServer* crash_server() const { return crash_server_; }
|
||||||
|
|
|
@ -60,8 +60,8 @@ const int kGUIDStringSize = 37;
|
||||||
|
|
||||||
void sigchld_handler(int signo) { }
|
void sigchld_handler(int signo) { }
|
||||||
|
|
||||||
int CreateTMPFile(const std::string& dir, std::string* path) {
|
int CreateTMPFile(const string& dir, string* path) {
|
||||||
std::string file = dir + "/exception-handler-unittest.XXXXXX";
|
string file = dir + "/exception-handler-unittest.XXXXXX";
|
||||||
const char* c_file = file.c_str();
|
const char* c_file = file.c_str();
|
||||||
// Copy that string, mkstemp needs a C string it can modify.
|
// Copy that string, mkstemp needs a C string it can modify.
|
||||||
char* c_path = strdup(c_file);
|
char* c_path = strdup(c_file);
|
||||||
|
@ -98,7 +98,7 @@ void WaitForProcessToTerminate(pid_t process_id, int expected_status) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reads the minidump path sent over the pipe |fd| and sets it in |path|.
|
// Reads the minidump path sent over the pipe |fd| and sets it in |path|.
|
||||||
void ReadMinidumpPathFromPipe(int fd, std::string* path) {
|
void ReadMinidumpPathFromPipe(int fd, string* path) {
|
||||||
struct pollfd pfd;
|
struct pollfd pfd;
|
||||||
memset(&pfd, 0, sizeof(pfd));
|
memset(&pfd, 0, sizeof(pfd));
|
||||||
pfd.fd = fd;
|
pfd.fd = fd;
|
||||||
|
@ -133,7 +133,7 @@ TEST(ExceptionHandlerTest, SimpleWithPath) {
|
||||||
|
|
||||||
TEST(ExceptionHandlerTest, SimpleWithFD) {
|
TEST(ExceptionHandlerTest, SimpleWithFD) {
|
||||||
AutoTempDir temp_dir;
|
AutoTempDir temp_dir;
|
||||||
std::string path;
|
string path;
|
||||||
const int fd = CreateTMPFile(temp_dir.path(), &path);
|
const int fd = CreateTMPFile(temp_dir.path(), &path);
|
||||||
ExceptionHandler handler(MinidumpDescriptor(fd), NULL, NULL, NULL, true, -1);
|
ExceptionHandler handler(MinidumpDescriptor(fd), NULL, NULL, NULL, true, -1);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -159,7 +159,7 @@ void ChildCrash(bool use_fd) {
|
||||||
AutoTempDir temp_dir;
|
AutoTempDir temp_dir;
|
||||||
int fds[2] = {0};
|
int fds[2] = {0};
|
||||||
int minidump_fd = -1;
|
int minidump_fd = -1;
|
||||||
std::string minidump_path;
|
string minidump_path;
|
||||||
if (use_fd) {
|
if (use_fd) {
|
||||||
minidump_fd = CreateTMPFile(temp_dir.path(), &minidump_path);
|
minidump_fd = CreateTMPFile(temp_dir.path(), &minidump_path);
|
||||||
} else {
|
} else {
|
||||||
|
@ -169,7 +169,7 @@ void ChildCrash(bool use_fd) {
|
||||||
const pid_t child = fork();
|
const pid_t child = fork();
|
||||||
if (child == 0) {
|
if (child == 0) {
|
||||||
{
|
{
|
||||||
scoped_ptr<ExceptionHandler> handler;
|
google_breakpad::scoped_ptr<ExceptionHandler> handler;
|
||||||
if (use_fd) {
|
if (use_fd) {
|
||||||
handler.reset(new ExceptionHandler(MinidumpDescriptor(minidump_fd),
|
handler.reset(new ExceptionHandler(MinidumpDescriptor(minidump_fd),
|
||||||
NULL, NULL, NULL, true, -1));
|
NULL, NULL, NULL, true, -1));
|
||||||
|
@ -238,6 +238,7 @@ static bool FilterCallbackReturnTrue(void* context) {
|
||||||
// redelivered to this handler. If the child dies with SIGSEGV then it wasn't.
|
// redelivered to this handler. If the child dies with SIGSEGV then it wasn't.
|
||||||
static void RaiseSIGKILL(int sig) {
|
static void RaiseSIGKILL(int sig) {
|
||||||
raise(SIGKILL);
|
raise(SIGKILL);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool InstallRaiseSIGKILL() {
|
static bool InstallRaiseSIGKILL() {
|
||||||
|
@ -917,7 +918,7 @@ TEST(ExceptionHandlerTest, WriteMinidumpExceptionStream) {
|
||||||
|
|
||||||
TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithFD) {
|
TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithFD) {
|
||||||
AutoTempDir temp_dir;
|
AutoTempDir temp_dir;
|
||||||
std::string path;
|
string path;
|
||||||
const int fd = CreateTMPFile(temp_dir.path(), &path);
|
const int fd = CreateTMPFile(temp_dir.path(), &path);
|
||||||
ExceptionHandler handler(MinidumpDescriptor(fd), NULL, NULL, NULL, false, -1);
|
ExceptionHandler handler(MinidumpDescriptor(fd), NULL, NULL, NULL, false, -1);
|
||||||
ASSERT_TRUE(handler.WriteMinidump());
|
ASSERT_TRUE(handler.WriteMinidump());
|
||||||
|
@ -942,7 +943,7 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
ASSERT_EQ(0, stat(minidump_1.path(), &st));
|
ASSERT_EQ(0, stat(minidump_1.path(), &st));
|
||||||
ASSERT_GT(st.st_size, 0U);
|
ASSERT_GT(st.st_size, 0U);
|
||||||
std::string minidump_1_path(minidump_1.path());
|
string minidump_1_path(minidump_1.path());
|
||||||
// Check it is a valid minidump.
|
// Check it is a valid minidump.
|
||||||
Minidump minidump1(minidump_1_path);
|
Minidump minidump1(minidump_1_path);
|
||||||
ASSERT_TRUE(minidump1.Read());
|
ASSERT_TRUE(minidump1.Read());
|
||||||
|
@ -953,7 +954,7 @@ TEST(ExceptionHandlerTest, GenerateMultipleDumpsWithPath) {
|
||||||
const MinidumpDescriptor& minidump_2 = handler.minidump_descriptor();
|
const MinidumpDescriptor& minidump_2 = handler.minidump_descriptor();
|
||||||
ASSERT_EQ(0, stat(minidump_2.path(), &st));
|
ASSERT_EQ(0, stat(minidump_2.path(), &st));
|
||||||
ASSERT_GT(st.st_size, 0U);
|
ASSERT_GT(st.st_size, 0U);
|
||||||
std::string minidump_2_path(minidump_2.path());
|
string minidump_2_path(minidump_2.path());
|
||||||
// Check it is a valid minidump.
|
// Check it is a valid minidump.
|
||||||
Minidump minidump2(minidump_2_path);
|
Minidump minidump2(minidump_2_path);
|
||||||
ASSERT_TRUE(minidump2.Read());
|
ASSERT_TRUE(minidump2.Read());
|
||||||
|
|
|
@ -80,7 +80,8 @@ typedef enum {
|
||||||
MD_EXCEPTION_CODE_LIN_SIGIO = 29, /* I/O now possible (4.2 BSD) */
|
MD_EXCEPTION_CODE_LIN_SIGIO = 29, /* I/O now possible (4.2 BSD) */
|
||||||
MD_EXCEPTION_CODE_LIN_SIGPWR = 30, /* Power failure restart (System V) */
|
MD_EXCEPTION_CODE_LIN_SIGPWR = 30, /* Power failure restart (System V) */
|
||||||
MD_EXCEPTION_CODE_LIN_SIGSYS = 31, /* Bad system call */
|
MD_EXCEPTION_CODE_LIN_SIGSYS = 31, /* Bad system call */
|
||||||
MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED = -1 /* No exception, dump requested */
|
MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED = 0xFFFFFFFF /* No exception,
|
||||||
|
dump requested. */
|
||||||
} MDExceptionCodeLinux;
|
} MDExceptionCodeLinux;
|
||||||
|
|
||||||
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__ */
|
#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_EXCEPTION_LINUX_H__ */
|
||||||
|
|
Loading…
Reference in a new issue