Jam and debug options

I’m looking how to compile the default app “Clock” wtih debugging symbols.

Currently without any debug symbol, the below is working fine:

cd generated.x86_64
jam Clock

Now I would like to compile with debug symbols only with the Clock sources (not the entire Haiku) :

How to do so ?
I didn’t find any reference to that (and I don’t know very well Jam)

I can only see the JamFile for Clock, so not sure if some additional options must be put in this file ?

SubDir HAIKU_TOP src apps clock ;

Application Clock : 
        cl_view.cpp 
        cl_wind.cpp 
        clock.cpp 
        : be localestub [ TargetLibsupc++ ]
        : Clock.rdef
        ;

DoCatalogs Clock :
        x-vnd.Haiku-Clock
        :
        cl_view.cpp
        clock.cpp
;
1 Like

Hello! You can set that in the build/jam/UserBuildConfig. UserBuildConfig.ReadMe explains

# UserBuildConfig can be used to customize the build according to your needs.
# If existent it is included by the build system, but it is ignored by Git.
...
# Set the debug level for directory src/system/boot/loader and recursively all
# of its subdirectories (scope is "global") to 1. All affected generated files
# will be put into another subtree of the "generated" directory, which allows
# for fast switching between normal and debug builds.
SetConfigVar DEBUG : HAIKU_TOP src system boot loader : 1 : global ;

(source)

3 Likes

Ok got it thanks !

cp …/build/jam/UserBuildConfig.sample …/build/jam/UserBuildConfig

Then I have to put the below line :

# Enable debugging for directory src/system/boot/loader recursively.
SetConfigVar DEBUG : HAIKU_TOP src apps : 1 : global ;

Then

file objects/haiku/x86_64/debug_1/apps/clock/Clock

objects/haiku/x86_64/debug_1/apps/clock/Clock: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, with debug_info, not stripped

And yes debugging is fine with GDB (note : but not with Debugger) :

3 Likes