google / glog

C++ implementation of the Google logging module
http://google.github.io/glog/
BSD 3-Clause "New" or "Revised" License
7.1k stars 2.07k forks source link

Incorrect stack trace for stripped binaries #1092

Closed xppt closed 7 months ago

xppt commented 8 months ago

If the executable is stripped, I expect the FailureSignalHandler to dump module+offset for each stack frame, but the output is always (unknown). Seems like this is because of a typo in OpenObjectFileContainingPcAndGetStartAddress.

Code to reproduce: repro.zip Just extract and run ./run_test.py on the host (docker and python3 are required).

Expected output

    @     0x7fa3c2b86699 __cxa_throw
    @     0x55a4ed24f389 (/build/testbin-stripped+0x2388)
    @     0x55a4ed24f3c6 main

Actual output

    @     0x7f81b4790699 __cxa_throw
    @     0x5645b9032389 (unknown)
    @     0x5645b90323c6 main
google-cla[bot] commented 8 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 64.41%. Comparing base (c0813f9) to head (78484ce).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1092 +/- ## ========================================== + Coverage 63.56% 64.41% +0.85% ========================================== Files 19 19 Lines 2566 2563 -3 Branches 910 909 -1 ========================================== + Hits 1631 1651 +20 + Misses 676 647 -29 - Partials 259 265 +6 ``` | [Files](https://app.codecov.io/gh/google/glog/pull/1092?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | | |---|---|---| | [src/symbolize.cc](https://app.codecov.io/gh/google/glog/pull/1092?src=pr&el=tree&filepath=src%2Fsymbolize.cc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-c3JjL3N5bWJvbGl6ZS5jYw==) | `63.75% <100.00%> (+7.22%)` | :arrow_up: | ... and [3 files with indirect coverage changes](https://app.codecov.io/gh/google/glog/pull/1092/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
xppt commented 8 months ago

Also, what's the output with your changes?

The stack trace contains module+offset line after patching:

    @     0x7fde6810f699 __cxa_throw
    @     0x55ce95d3d389 (/build/testbin-stripped+0x2388)
    @     0x55ce95d3d3c6 main
sergiud commented 7 months ago

Thank you!