[SERVER-59314] Report file and line in stack traces Created: 12/Aug/21 Updated: 19/Oct/23 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Robert Guo (Inactive) | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 4 |
| Labels: | sa-remove-fv-backlog-22 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Assigned Teams: |
Service Arch
|
||||||||||||||||||||
| Sprint: | Service Arch 2022-12-26, Service Arch 2022-07-11, Service Arch 2022-07-25, Service Arch 2022-08-08, Service Arch 2022-08-22, Service Arch 2022-09-05, Service Arch 2022-09-19, Service Arch 2022-10-31, Service Arch 2022-11-14, Service Arch 2022-11-28, Service Arch 2022-12-12, Service Arch 2023-01-09, Service Arch 2023-01-23, Service Arch 2023-02-06, Service Arch 2023-02-20 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
It'll be nice to get line numbers by default in stack traces so that for local development, there'd be less need for symbolizing for local runs. gcc -g1 or -g2 should be sufficient on Linux Windows already has line numbers, I believe. |
| Comments |
| Comment by Billy Donahue [ 23/Mar/23 ] | ||||||||||
|
Ok thank you for doing the due diligence on that. I might be able to do it with libdwarf, which is under the "CC-BY" license, aka: It would only affect the internals of the DwarfMetadataResolver class in my PR. Next time I'm working on this ticket I'll try that. | ||||||||||
| Comment by Juan Gu [ 23/Mar/23 ] | ||||||||||
|
Hi billy.donahue@mongodb.com , alexander.neben@mongodb.com , daniel.moody@mongodb.com , and I have discussed this with the legal department, and unfortunately, we don't believe it's currently possible to add what you've requested. While it may be possible, it would require a highly technical lift. From https://sourceware.org/elfutils/, it has been licensed with 'License. The libraries and backends are dual GPLv2+/LGPLv3+. The utilities are GPLv3+.' it has a conflict with our Inbound Open Source Policy | ||||||||||
| Comment by Charlie Swanson [ 15/Feb/23 ] | ||||||||||
|
Very cool! Thanks for looking into this billy.donahue@mongodb.com! | ||||||||||
| Comment by Billy Donahue [ 08/Feb/23 ] | ||||||||||
|
draft PoC PR: Demo! Cause a mongod to crash, click on the filename:line:col source locations in the stack trace. VSCode jumps to those cursor positions. | ||||||||||
| Comment by Jason Chan [ 08/Jul/22 ] | ||||||||||
|
robert.guo@mongodb.com, would someone from DAG be able to follow-up on daniel.gottlieb@mongodb.com's questions? I don't think Service Arch has knowledge about the current state. | ||||||||||
| Comment by Robert Guo (Inactive) [ 13/Sep/21 ] | ||||||||||
|
Thanks for the insight Drew! geert.bosch Since it looks like more investigation's needed here , would you have recommendations for next steps? | ||||||||||
| Comment by Andrew Morrow (Inactive) [ 13/Sep/21 ] | ||||||||||
|
robert.guo and geert.bosch - I'm not sure I understand the request here. We already always build with -ggdb which implies -g. Per https://gcc.gnu.org/onlinedocs/gcc-8.5.0/gcc/Debugging-Options.html#Debugging-Options the default -glevel is 2. So I believe we are already effectively building with -g2. Note further that all of the debug info generation levels include line number tables, except for -g0, which disables debug info entirely. Building a trivial hello_world.cpp with the v3 mongodbtoolchain using -ggdb and -g2 and then comparing sizes suggests that they produce identical output:
The two byte difference is due to the DWARF recording of the command line, and that can be eliminated entirely by building with -gno-record-gcc-switches.
If the request is to have the mongodb stacktrace code emit file and line numbers, I think the debug info we are currently generating is sufficient for that purpose, but we would likely need to either teach libunwind how to do it, or to integrate with elfutils and dig that information out ourselves while iterating with libunwind. | ||||||||||
| Comment by Robert Guo (Inactive) [ 12/Aug/21 ] | ||||||||||
|
cc geert.bosch, who came up with the idea. |