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

Improve Windows crash log #2736

Merged
merged 2 commits into from
Nov 15, 2023
Merged

Improve Windows crash log #2736

merged 2 commits into from
Nov 15, 2023

Conversation

Noisyfox
Copy link
Collaborator

@Noisyfox Noisyfox commented Nov 14, 2023

When we distribute the app to users, it won't come with the PBD file bundled due to the size, which means we will not be able to show the debug symbols (such as function name, source file location, line number etc.) in the crash log. And given the fact that current crash log only shows the virtual address of each function call, it's hard to calculate the RVA of the function which will then be used to locate the function using the PBD file.

This PR shows the section id and the offset within that section for the function address of each stack frame, which then can be used to calculate the function's RVA and also locate the debug symbol in PBD with the help of WinDBG.

The format of the output will be:
<function virtual address> <section number>:<section offset> <module path>, and the function's RVA will be the section's virtual address (which we will find out with the help of WinDBG) + section offset.

Given the following line from the crash log:

0x8224D5DC 0x1:0x8DC5DC D:\projects\OrcaSlicer\build\src\RelWithDebInfo\OrcaSlicer.dll

Once we load the OrcaSlicer.dll file in WinDBG with the correct PDB file, we can follow these steps to get the debug symbol:

  1. lm, which gives you the name of the module:
start             end                 module name
00000001`80000000 00000001`856f2000   OrcaSlicer C (private pdb symbols)  C:\ProgramData\Dbg\sym\OrcaSlicer.pdb\1CE5DACBDA6C4A85B8D7EBD6C21635B010\OrcaSlicer.pdb

in which OrcaSlicer is the module name, which will be used in the following steps.
2. !dh OrcaSlicer, which list the sections of this module. What we need to find is the section 0x1, as indicated in the crash log:

SECTION HEADER #1
   .text name
 3BAE26C virtual size
    1000 virtual address
 3BAE400 size of raw data
     400 file pointer to raw data
       0 file pointer to relocation table
       0 file pointer to line numbers
       0 number of relocations
       0 number of line numbers
60000020 flags
         Code
         (no align specified)
         Execute Read

what important to us is the value of virtual address, which is 0x1000 in our case
3. ln OrcaSlicer + 1000 + 0x8DC5DC, which reveals the final symbol:

[D:\projects\OrcaSlicer\src\libslic3r\ExtrusionEntity.cpp @ 147] (00000001`808dd580)   OrcaSlicer!Slic3r::ExtrusionLoop::polygon+0x5c   |  (00000001`808dd7c0)   OrcaSlicer!Slic3r::ExtrusionLoop::length

Note: the CI process will need to be updated to upload the PBD file as well.

@Noisyfox Noisyfox marked this pull request as ready for review November 15, 2023 02:36
Copy link
Owner

@SoftFever SoftFever left a comment

Choose a reason for hiding this comment

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

You da man!

@SoftFever SoftFever merged commit 016d3a7 into SoftFever:main Nov 15, 2023
4 checks passed
@Noisyfox Noisyfox deleted the dev/crash-log branch November 15, 2023 11:11
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