Skip to content

[drmingw] Patch to add support for reading debug symbols from external files to exchndl.dll #40

@GoogleCodeExporter

Description

@GoogleCodeExporter
Currently, exchndl will read only stabs debugging symbols directly from the 
relevant modules.

This patch adds the additional ability to read debug symbols from files that 
exist alongside the modules.  This makes it possible to generate useful crash 
reports from stripped binaries by reading the symbols from a unstripped copy of 
the binary.

If the module has version information embedded, a comparison is done to make 
sure that the corresponding "debug symbols" module has the same version 
information specified.

By default, it only looks for a "module.ext.dbgsym" file in the same directory 
as the module.

An alternate directory structure for looking up debug symbols can be specified 
by calling "SetDebugInfoDir" on the loaded exchndl.dll instance.  The 
DebugInfoDir is intended to be a parallel directory structure to the stripped 
application structure containing the corresponding ".dbgsym" files.

For Example:
...\Application\app.exe
...\Application\applib.dll
...\Application\plugins\plugin.dll

The DebugInfoDir looks like this:
...\Application\dbgsym-1.0.1.1\app.exe.dbgsym
...\Application\dbgsym-1.0.1.1\applib.dll.dbgsym
...\Application\dbgsym-1.0.1.1\plugins\plugin.dll.dbgsym

The following code sets up the DebugInfoDir:

if ((hmod = LoadLibraryW(L"exchndl.dll"))) {
    FARPROC proc;
    char debug_dir[MAX_PATH];
    proc = GetProcAddress(hmod, "SetDebugInfoDir");
    if (proc) {
        _snprintf(debug_dir, sizeof(debug_dir) / sizeof(char),
            "%s\\dbgsym-%s", app_install_dir,  VERSION);
        debug_dir[sizeof(debug_dir) / sizeof(char) - 1] = '\0';
        printf(" Setting exchndl.dll DebugInfoDir to %s\n",
            debug_dir);
        (proc)(debug_dir);
    }
}

In my use case, I distribute stripped modules and then have a separate zip file 
that can be later extracted to the DebugInfoDir location if needed to help get 
a useful crash report.

This patch contains (and is a superset of) the patch in id 39.

Original issue reported on code.google.com by daniel.a...@gmail.com on 28 Aug 2010 at 3:59

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions