Skip to content

Add the Frame::sp method to get the frame's stack pointer#341

Merged
alexcrichton merged 2 commits into
rust-lang:masterfrom
fitzgen:sp
Jun 9, 2020
Merged

Add the Frame::sp method to get the frame's stack pointer#341
alexcrichton merged 2 commits into
rust-lang:masterfrom
fitzgen:sp

Conversation

@fitzgen

@fitzgen fitzgen commented Jun 5, 2020

Copy link
Copy Markdown
Member

@fitzgen

fitzgen commented Jun 5, 2020

Copy link
Copy Markdown
Member Author

No idea what is up with the arm-unknown-linux-gnueabihf tests:

qemu: Unsupported syscall: 397
test many_threads ... ok
test smoke_test_frames ... ok
fatal runtime error: failed to initiate panic, error 9
error: test failed, to rerun pass '--test smoke'

Caused by:
  process didn't exit successfully: `qemu-arm -L /usr/arm-linux-gnueabihf /checkout/target/arm-unknown-linux-gnueabihf/debug/deps/smoke-10e38a2f0d8ebee1` (signal: 6, SIGABRT: process abort signal)
##[error]Process completed with exit code 101

@alexcrichton alexcrichton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor nits about the test, but otherwise seems good to me!

Comment thread tests/smoke.rs

let mut is_recursive_stack_references = false;
backtrace::resolve(frame.ip(), |sym| {
is_recursive_stack_references |= (LIBBACKTRACE || GIMLI_SYMBOLIZE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the LIBBACKTRACE || GIMLI_SYMBOLIZE part here necessary? It looks like this handles a non-present name?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can't rely on symbolication, then we can't determine which stack frames are the ones we are interested in (due to inlining happening or not), and therefore don't know when to pop from our stack of on-stack references.

Comment thread tests/smoke.rs Outdated
Comment thread tests/smoke.rs Outdated
@alexcrichton

Copy link
Copy Markdown
Member

Hm ok so the failing test here seems semi-legitimate. It looks like the test is panicking but in emulation the panic fails for... whatever reason. The test harness is capturing output to print later but the abort means it doesn't get printed. Anyway passing --nocapture the output looks like:

running 3 tests
test many_threads ... ok
test smoke_test_frames ... symbol  ip:0xffe9a950 address:0xffe9a950 name:smoke::smoke_test_frames::frame_4::hc85e98dee3b06640 file:/checkout/tests/smoke.rs lineno:18 
symbol  ip:0xffe9a908 address:0xffe9a908 name:smoke::smoke_test_frames::frame_3::h6d55155098f3e65e file:/checkout/tests/smoke.rs lineno:15 
symbol  ip:0xffe9a8ec address:0xffe9a8ec name:smoke::smoke_test_frames::frame_2::h98465abd29b4bfc6 file:/checkout/tests/smoke.rs lineno:14 
symbol  ip:0xffe9a8d0 address:0xffe9a8d0 name:smoke::smoke_test_frames::frame_1::hcd16b4600e849d0d file:/checkout/tests/smoke.rs lineno:13 
symbol  ip:0xffe9a8b4 address:0xffe9a8b4 name:smoke::smoke_test_frames::h4b3feb7e02233f3e file:/checkout/tests/smoke.rs lineno:12 
ok
test sp_smoke_test ... 
=== frame ===================================
name = _ZN9backtrace9backtrace9libunwind5trace17he04a1f50969a4bcaE
name = _ZN9backtrace9backtrace20trace_unsynchronized17h414525a2d0b36f54E
sp  = 0x5

=== frame ===================================
name = _ZN9backtrace9backtrace5trace17h4bf49cef1db4e66fE
sp  = 0x5

=== frame ===================================
name = _ZN5smoke13sp_smoke_test26recursive_stack_references17h6922757508a9c368E
sp  = 0x5
ref = 0xffe8ccdc

=== frame ===================================
name = _ZN5smoke13sp_smoke_test26recursive_stack_references17h6922757508a9c368E
sp  = 0x5
ref = 0xffe8cd84
thread 'main' panicked at 'assertion failed: sp >= child_ref', tests/smoke.rs:301:25
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 9
error: test failed, to rerun pass '--test smoke'

Caused by:
  process didn't exit successfully: `qemu-arm -L /usr/arm-linux-gnueabihf /checkout/target/arm-unknown-linux-gnueabihf/debug/deps/smoke-10e38a2f0d8ebee1 --nocapture` (signal: 6, SIGABRT: process abort signal)

@fitzgen

fitzgen commented Jun 9, 2020

Copy link
Copy Markdown
Member Author

Okay! I've got arm-unknown-linux-gnueabihf working locally, I think that was the only one failing, but lets see what CI thinks...

@alexcrichton alexcrichton merged commit 635e159 into rust-lang:master Jun 9, 2020
@alexcrichton

Copy link
Copy Markdown
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants