Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace 'execinfo.h' backtrace with a rust-generated backtrace #2237

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

stevenengler
Copy link
Contributor

@stevenengler stevenengler commented Jun 23, 2022

The rust backtrace has better symbol resolution.

Example:

**ERROR ENCOUNTERED**
        At process: 3260702 (parent 3260700)
        At file: /shared/code/shadow/rust-backtrace/src/main/host/process.c
        At line: 501
        At function: _process_openStdIOFileHelper
        Message: Assertion failed: 0
**BEGIN BACKTRACE**
           0: backtrace
                     at /shared/code/shadow/rust-backtrace/src/main/utility/mod.rs:245:33
           1: utility_handleError
                     at /shared/code/shadow/rust-backtrace/src/main/utility/utility.c:110:29
           2: _process_openStdIOFileHelper
                     at /shared/code/shadow/rust-backtrace/src/main/host/process.c:501:5
           3: _process_start
                     at /shared/code/shadow/rust-backtrace/src/main/host/process.c:540:5
           4: _process_runStartTask
                     at /shared/code/shadow/rust-backtrace/src/main/host/process.c:751:5
           5: shadow_rs::core::work::task::export::CTaskHostTreePtrs::execute
                     at /shared/code/shadow/rust-backtrace/src/main/core/work/task.rs:83:13
           6: shadow_rs::core::work::task::export::taskref_new_bound::{{closure}}
                     at /shared/code/shadow/rust-backtrace/src/main/core/work/task.rs:187:56
           7: shadow_rs::core::work::task::TaskRef::execute
                     at /shared/code/shadow/rust-backtrace/src/main/core/work/task.rs:29:9
           8: taskref_execute
                     at /shared/code/shadow/rust-backtrace/src/main/core/work/task.rs:261:9
           9: event_execute
                     at /shared/code/shadow/rust-backtrace/src/main/core/work/event.c:89:9
          10: worker_runEvent
                     at /shared/code/shadow/rust-backtrace/src/main/core/worker.c:459:5
          11: _scheduler_runEventsWorkerTaskFn
                     at /shared/code/shadow/rust-backtrace/src/main/core/scheduler/scheduler.c:85:9
          12: _worker_run
                     at /shared/code/shadow/rust-backtrace/src/main/core/worker.c:429:13
          13: start_thread
                     at /build/glibc-sMfBJT/glibc-2.31/nptl/pthread_create.c:477:8
          14: clone
**END BACKTRACE**
**ABORTING**

@stevenengler stevenengler added Type: Maintenance Refactoring, cleanup, documenation, or process improvements Component: Main Composing the core Shadow executable labels Jun 23, 2022
@stevenengler stevenengler self-assigned this Jun 23, 2022
@github-actions github-actions bot added the Component: Build Build/install tools and dependencies label Jun 23, 2022
The rust backtrace has better symbol resolution.
@stevenengler stevenengler merged commit 8c90793 into shadow:main Jun 23, 2022
@stevenengler stevenengler deleted the rust-backtrace branch June 23, 2022 19:08
@@ -293,6 +293,11 @@ void statusLogger_updateEmuTime(const struct StatusLogger_ShadowStatusBarState *
void statusLogger_updateNumFailedProcesses(const struct StatusLogger_ShadowStatusBarState *status_logger,
uint32_t num_failed_processes);

// Get the backtrace. This function is slow. The string must be freed using `free_backtrace()`.
Copy link
Contributor

Choose a reason for hiding this comment

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

backtrace_free()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops nice catch! I'll fix that in a follow-up PR.

@@ -237,3 +237,28 @@ mod tests {
}
}
}

mod export {
/// Get the backtrace. This function is slow. The string must be freed using `free_backtrace()`.
Copy link
Contributor

Choose a reason for hiding this comment

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

backtrace_free()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Build Build/install tools and dependencies Component: Main Composing the core Shadow executable Type: Maintenance Refactoring, cleanup, documenation, or process improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants