3

This is my makefile. I would also like to generate .pdb files. I am already using the -g option however I dont see any file created with .pdb extension. The post here also stated to use -g option.

CXX = g++
CXXFLAGS = -Wall -g


all: comment \
     test


comment:
    @echo ------Starting Build Process-----------------


test:  main.o car.o student.o   house.o 
    $(CXX) $(CXXFLAGS) -o test main.o car.o student.o house.o

main.o: student.h house.h    main.cpp
    $(CXX) $(CXXFLAGS) -c main.cpp

car.o: car.h

student.o: student.h car.h

house.o: house.h 

clean:
    rm -rf *.o test

Any suggestions on how to generate pdb files ?

Community
  • 1
  • 1
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
  • see http://stackoverflow.com/questions/866721/how-to-generate-gcc-debug-symbol-outside-the-build-target and https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html – SleuthEye Oct 26 '14 at 00:23
  • I am using `objcopy --only-keep-debug test test.debug` if I use .pdb instead of debug will I get a valid pdb ? – Rajeshwar Oct 26 '14 at 00:36
  • so long as with 'valid' you do not mean Microsoft's proprietary file format – SleuthEye Oct 26 '14 at 00:44

2 Answers2

6

I would also like to generate .pdb files

You can't: the PDB file format is Microsoft-proprietary and undocumented, and thus can't be generated by non-Microsoft tools.

Nor would the PDB file be usable on Linux. In other words, your desire to generate PDB is likely due to some lack of understanding on your part.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
0

Please take a look at Alexey Alexandrov's response at How do I generate symbol information to use with Linux version of Intel's VTune Amplifier?:

Another useful consideration for any developer working on production software is to use separate debug information files!. That assumes compiling the program with "-g" as described above and then using objcopy utility to copy out the ELF sections containing debug information into a separate file and adding a link from the original binary file to the separate debug information file. This is extremely useful for being able to store the debug information for the bits you released to a customer so that post-mortem debugging is possible. And of course, for performance profiling on the release bits, too.

That is the closest mapping between Microsoft's PDB files and Linux I am aware of.

ThM
  • 31
  • 4