rainers / cv2pdb

converter of DMD CodeView/DWARF debug information to PDB files
Artistic License 2.0
472 stars 109 forks source link

Can't display local/global variables for MinGW-w64 4.6.3 32-bit generated executable #7

Closed net147 closed 9 years ago

net147 commented 9 years ago

test.cpp

int x = 4;
int y = 5;
int z = 6;

int main() 
{
    int a = 1;
    int b = 2;
    int c = 3;
    int *m = 0;
    *m = 1;
    return c;
}
g++ -O0 -g test.cpp -o test.exe
cv2pdb -C -ptest.pdb test.exe
devenv.exe /Run test.exe

Compiler: http://www.mirrorservice.org/sites/downloads.sourceforge.net/m/mi/mingwbuilds/host-windows/releases/4.6.3/32-bit/threads-posix/sjlj/x32-4.6.3-release-posix-sjlj-rev2.7z

Using cv2pdb from git b5dcff365db1a53934a9a896ae3d4580d52d0eea, the local/global variables are not displayed and adding them to the watch window manually shows identifier is undefined. This was previously working in cv2pdb 0.31.

rainers commented 9 years ago

I've pushed some fixes to master. I suspect the refactoring https://github.com/rainers/cv2pdb/pull/1 killed some functionality for other compiler versions.

net147 commented 9 years ago

Thanks. That fixes display of global variables but local variables still show as undefined.

rainers commented 9 years ago

Works for me in VS2013 with the example above, both x86 and x64. Which version of Visual Studio are you using?

net147 commented 9 years ago

I started VS2013 x86 Native Tools Command Prompt from Visual Studio 2013 folder in Start Menu and ran the commands there. Are you using the compiler I linked to? The compiler outputs Windows 32-bit binaries.

rainers commented 9 years ago

Yes, I used the compiler linked above. With option -m64 it generated code for x64, too. Can you make your executable available for download?

net147 commented 9 years ago
C:\>g++ --version
g++ (Built by MinGW-builds project) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here is output of g++ -O0 -g test.cpp -o test.exe. Download: https://www.dropbox.com/s/28cxex00joskhlg/test.exe

rainers commented 9 years ago

Thanks. Once the locals worked for me, I've added function parameters that were broken, too, and didn't test without them later. I have committet a fix for the locals, but I see similar errors for struct declarations. I should have tested the PR better...

net147 commented 9 years ago

The display of locals are working now. Thanks.

net147 commented 9 years ago

Should another issue be created for struct declarations? For example, the struct in http://www.dsource.org/projects/cv2pdb/attachment/ticket/12/test.cpp doesn't display properly in the locals window.

rainers commented 9 years ago

I've committed a fix for structs, classes and array bounds. If you still find issues, please open a new bug report.