nicholascw / b23.wtf

Remove tracing parameters from b23.tv/*.
https://b23.wtf
GNU General Public License v3.0
129 stars 4 forks source link

Feat: generate separate debug symbols file #4

Closed pzhlkj6612 closed 2 years ago

pzhlkj6612 commented 2 years ago

Motivation: I would like to debug this program with gdb.

Adding debug info to the executable would produce a bigger file (from 36 KB to 100 KB), so I put it in a separate debug symbols file.

nicholascw commented 2 years ago

closed by ef2b58fb6317691f18a43850e65f818e0d193acc. Use make b23_broker_dbg instead.

pzhlkj6612 commented 2 years ago

Hi.

closed by ef2b58fb6317691f18a43850e65f818e0d193acc. Use make b23_broker_dbg instead.

Thanks for your reply. But unfortunately, ef2b58fb6317691f18a43850e65f818e0d193acc does not work:

$ git switch -d 'ef2b58fb6317691f18a43850e65f818e0d193acc' && \
> git restore . && \
> git clean -xfd && \
> mkdir -p obj && \
> make b23_broker_dbg && \
> file ./obj/server.o ./b23_broker_dbg && \
> gdb -q ./b23_broker_dbg -ex 'info target' -ex 'q'
HEAD is now at ef2b58f Make target w/ dbg symbol
Removing b23_broker_dbg
Removing obj/
cc -O2 -fPIC -Wall -Wextra -pthread -c -o obj/server.o src/server.c
cc -g -DDEBUG -O2 -fPIC -Wall -Wextra -pthread obj/server.o -o b23_broker_dbg 
./obj/server.o:   ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
./b23_broker_dbg: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=43ee7f259d3128556f4c0d7b03e009ecf86fe4a1, for GNU/Linux 3.2.0, not stripped
Reading symbols from ./b23_broker_dbg...
(No debugging symbols found in ./b23_broker_dbg)
Symbols from ".../b23.wtf/backend/b23_broker_dbg".
Local exec file:
        `.../b23.wtf/backend/b23_broker_dbg', file type elf64-x86-64.
        ...

As you can see, the generated objects don't contain debug info.

I made #6 and it achieves the goal of this PR in a better way.