For.Bin or.Exe files, how does a linker generate line numbers in debug information?

moecmks via Digitalmars-d-debugger digitalmars-d-debugger at puremagic.com
Sat Jun 17 07:04:45 PDT 2017


On Saturday, 17 June 2017 at 12:05:31 UTC, Rainer Schuetze wrote:
>
>
> On 17.06.2017 04:17, moecmks wrote:
>> I come from China, my English is not very high. Please forgive 
>> me.
>> 
>> First provide the context
>> 
>> @:debugger,IDA 6.8
>> @:this is my source file <hello.d>, only this one.
>> 
>> import std.stdio;
>> 
>> void main () {
>> 
>>    writeln ("Hello World");
>> }
>> 
>> I've found that for.Obj, using the -c -debug -gc -m32 command 
>> always generates line number information that is seen by the 
>> debugger
>> 
>> However, as long as the connection is exe or bin, the debugger 
>> can only see variable symbols, but no line numbers can be 
>> seen,I don't know if I've done anything wrong 0_0
>> 
>> this is my linker's command:$(LINK) /CO:4/DEBUG /CODEVIEW 
>> /DEBUGLINES /DEBUGMODULES:$(OBJPATH)\hello.obj 
>> $(OBJPATH)\hello.obj
>
> The debug information emitted by compiling with -m32 follows a 
> very old CodeView 4 specification that isn't well understood by 
> current debuggers.
>
> With cv2pdb (https://github.com/rainers/cv2pdb/releases) you 
> can convert this debug information into a PDB file following 
> newer standards but you'll need some components from the 
> Microsoft tool chain to execute it.
>
> Alternatively you can compile with -m32mscoff or -m64 that will 
> use the Microsoft linker and the MS C runtime. This will 
> generate a PDB file directly.

You are powerful!. Your bin file, because of the Chinese GFW 
relationship, I can't download it, but I can download the source 
code! Because I used VS2012 to compile your code.
There are two major errors that can not be compiled
@1:Syntax errors during compilation
@ for partial structure construction, grammatical errors are 
reported
If (at = = DW_AT_data_member_location) {
Stack[stackDepth++] = Location (Location:: Abs, 0, 0);
}
@2:Symbolic parsing during link
@decodeLocation, interpretDWARFLines, and so on functions are not 
implemented
@ I went to your project's Github repository, searched for these 
functions, added several.Cpp files added to the VS project, 
entered, compiled successfully, and then cv2pdb, some, EXE, and 
got the pdb file
Then I used IDA to load the PDB file and found that not only can 
I see the debug line number, but also the specific source code, 
which is exactly what I want.

You've got my attention, great programmer!
I hope I can ask you some questions later 0_0


More information about the Digitalmars-d-debugger mailing list