Skip to content

Commit

Permalink
Remove the redundant MDExceptionCodeLinux enum and use the values fro…
Browse files Browse the repository at this point in the history
…m minidump-common instead (#62)

* Remove the redundant MDExceptionCodeLinux enum and use the values from minidump-common instead

* Ignore new clippy lint in 1.65.0

* Build and run tests in release

Co-authored-by: Jake Shadle <jake.shadle@embark-studios.com>
  • Loading branch information
gabrielesvelto and Jake-Shadle authored Nov 4, 2022
1 parent 18d57a8 commit 42c74f1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
- name: Fetch
run: cargo fetch --target ${{ matrix.job.target }}
- name: Build
run: cargo test --target ${{ matrix.job.target }} --no-run
run: cargo test --target ${{ matrix.job.target }} --release --no-run
- name: Test
run: cargo test --target ${{ matrix.job.target }}
run: cargo test --target ${{ matrix.job.target }} --release

# This job builds non-tier1 targets that aren't already tested
build_lower_tier:
Expand Down
3 changes: 3 additions & 0 deletions src/linux.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// `WriterError` is large and clippy doesn't like that, but not a huge deal atm
#![allow(clippy::result_large_err)]

#[cfg(target_os = "android")]
mod android;
pub mod app_memory;
Expand Down
43 changes: 2 additions & 41 deletions src/linux/sections/exception_stream.rs
Original file line number Diff line number Diff line change
@@ -1,45 +1,6 @@
use super::minidump_writer::CrashingThreadContext;
use super::*;

#[allow(non_camel_case_types, unused)]
#[repr(u32)]
enum MDExceptionCodeLinux {
MD_EXCEPTION_CODE_LIN_SIGHUP = 1, /* Hangup (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGINT = 2, /* Interrupt (ANSI) */
MD_EXCEPTION_CODE_LIN_SIGQUIT = 3, /* Quit (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGILL = 4, /* Illegal instruction (ANSI) */
MD_EXCEPTION_CODE_LIN_SIGTRAP = 5, /* Trace trap (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGABRT = 6, /* Abort (ANSI) */
MD_EXCEPTION_CODE_LIN_SIGBUS = 7, /* BUS error (4.2 BSD) */
MD_EXCEPTION_CODE_LIN_SIGFPE = 8, /* Floating-point exception (ANSI) */
MD_EXCEPTION_CODE_LIN_SIGKILL = 9, /* Kill, unblockable (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGUSR1 = 10, /* User-defined signal 1 (POSIX). */
MD_EXCEPTION_CODE_LIN_SIGSEGV = 11, /* Segmentation violation (ANSI) */
MD_EXCEPTION_CODE_LIN_SIGUSR2 = 12, /* User-defined signal 2 (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGPIPE = 13, /* Broken pipe (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGALRM = 14, /* Alarm clock (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGTERM = 15, /* Termination (ANSI) */
MD_EXCEPTION_CODE_LIN_SIGSTKFLT = 16, /* Stack faultd */
MD_EXCEPTION_CODE_LIN_SIGCHLD = 17, /* Child status has changed (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGCONT = 18, /* Continue (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGSTOP = 19, /* Stop, unblockable (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGTSTP = 20, /* Keyboard stop (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGTTIN = 21, /* Background read from tty (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGTTOU = 22, /* Background write to tty (POSIX) */
MD_EXCEPTION_CODE_LIN_SIGURG = 23,
/* Urgent condition on socket (4.2 BSD) */
MD_EXCEPTION_CODE_LIN_SIGXCPU = 24, /* CPU limit exceeded (4.2 BSD) */
MD_EXCEPTION_CODE_LIN_SIGXFSZ = 25,
/* File size limit exceeded (4.2 BSD) */
MD_EXCEPTION_CODE_LIN_SIGVTALRM = 26, /* Virtual alarm clock (4.2 BSD) */
MD_EXCEPTION_CODE_LIN_SIGPROF = 27, /* Profiling alarm clock (4.2 BSD) */
MD_EXCEPTION_CODE_LIN_SIGWINCH = 28, /* Window size change (4.3 BSD, Sun) */
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_SIGSYS = 31, /* Bad system call */
MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED = 0xFFFFFFFF, /* No exception,
dump requested. */
}
use minidump_common::errors::ExceptionCodeLinux;

pub fn write(
config: &mut MinidumpWriter,
Expand All @@ -58,7 +19,7 @@ pub fn write(
_ => 0,
};
MDException {
exception_code: MDExceptionCodeLinux::MD_EXCEPTION_CODE_LIN_DUMP_REQUESTED as u32,
exception_code: ExceptionCodeLinux::DUMP_REQUESTED as u32,
exception_address: addr as u64,
..Default::default()
}
Expand Down

0 comments on commit 42c74f1

Please sign in to comment.