Skip to content

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

Merged
stevenengler merged 1 commit intoshadow:mainfrom
stevenengler:rust-backtrace
Jun 23, 2022
Merged

Replace 'execinfo.h' backtrace with a rust-generated backtrace#2237
stevenengler merged 1 commit intoshadow:mainfrom
stevenengler:rust-backtrace

Conversation

@stevenengler
Copy link
Copy Markdown
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 requested a review from sporksmith June 23, 2022 18:28
@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
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
Copy Markdown
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
Copy Markdown
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.

}

mod export {
/// Get the backtrace. This function is slow. The string must be freed using `free_backtrace()`.
Copy link
Copy Markdown
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.

3 participants