Using the Optimizing VC7 compiler with the VC6 IDE,with DEBUGGING

Using the Optimizing VC7 compiler with the VC6 IDE,with DEBUGGING

you may contact him at: ywjheart ## (replace ## to @)

from the source of atl/mfc in vc7x series,wo can see something interesting,that vc7 is able to output pdb files in the format used in vc6,the options is as following:
cl.exe:  /Zvc6
link.exe: /debugtype:vc6

however,vc7 toolset refuse the options if we add to commandline.
They lie to us,in fact,after debugging,we know M$ close the interface in commandline,but leave the functions in binaries.
OK,let’s patch the toolset,in order to reenable the capability we need.

1.install vc2003toolkit(any vc2003 edition is ok,and psdk/ddk 2003 also has these files),i’ll use the toolset unpack from vc2003sp1,it’s the lastest version.
copy the following files to C:Program FilesMicrosoft Visual StudioVC98bin,don’t forget to backup files from vc6!
2. take a copy of the mspdb60.dll from PSDK/DDK2003,its version should equal to 6.2
3. hex editor

start patch:
1.1 modify the compiler front end
c1.dll in offset 78a11,change 0 to 1;
c1xx.dll in offset 18D3B1,change 0 to 1;
1.2 modify the compiler back end
c2.dll in offset 744C,change 1D to 3D;

2. modify the linker
from 2a4dc to 2a4e7
original:  8A 98 60 01 00 00 84 DB
after patch: B3 01 88 98 60 01 00 00 c1.dll,c1xx.dll,c2.dll,cl.exe,link.exe in a hex editor
replace all string "mspdb71.dll" to "mspdb60.dll" link.exe,search the string ?Open@PDB@@SAHPBD0KPAJQADPAPAU1@@Z ,and change it to ?Open@PDB@@SAHPAD0KPAJQADPAPAU1@@Z

5.copy the mspdb60.dll v6.2 to bin folder.

all you can new a console project, and build the debug configuration,open the output file in a hex editor,you can find the  signature of  the old pdb format,"NB10",set a break in the function "main",and press F5, after break,you can see variables,callstack,and etc.



1 Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s