Skip to content

Commit

Permalink
Fix sigfault on lldb::SBFrame::function_name
Browse files Browse the repository at this point in the history
(lldb) bt
* thread endoli#1, name = 'crash_analyse', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00007ffff60ec661 libc.so.6`__strlen_avx2 + 17
    frame endoli#1: 0x000055555556b859 crash_analyse`std::ffi::c_str::CStr::from_ptr::h7d6778659191997d at c_str.rs:904
    frame endoli#2: 0x000055555555ed45 crash_analyse`lldb::frame::SBFrame::function_name::h6e8217ef78893c79(self=0x00007fffffffe848) at frame.rs:153
  • Loading branch information
sardChen authored Jul 12, 2018
1 parent 28c3e86 commit 790a334
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl SBFrame {
/// See also `is_inlined`.
pub fn function_name(&self) -> Option<&str> {
unsafe {
match CStr::from_ptr(sys::SBFrameGetFunctionName(self.raw)).to_str() {
match CStr::from_ptr(sys::SBFrameGetFunctionName(self.raw).as_ref()?).to_str() {
Ok(s) => Some(s),
_ => None,
}
Expand Down

0 comments on commit 790a334

Please sign in to comment.