Configure a debug build with meson setup --buildtype=debug
Configure a debug build directory with meson setup --buildtype=debug in Meson 1.6 and see which flags the buildtype expands into.
In Meson the build type is a single option that stands for a bundle of two others, optimisation and debug information. Picking debug at setup time is one way to ask for -O0 -g.
meson setup build-debug --buildtype=debug
meson compile -C build-debug -v[1/2] cc -Ibuild-debug/demo.p -Ibuild-debug -I../src -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O0 -g -MD -MQ demo.p/main.c.o -MF demo.p/main.c.o.d -o demo.p/main.c.o -c ../src/main.cThe -O0 -g at the end of the options come from the buildtype. The other values are debugoptimized (-O2 -g), release (-O3, no debug info) and minsize (-Os). Meson also supports plain, which adds no flags of its own and is the one distributions use so that their own CFLAGS apply. The table is in the buildtype reference.
Since Meson 1.0 the preferred form splits the two parts: -Doptimization=0 -Ddebug=true, and buildtype is a shorthand. Setting both at once is allowed, and the later explicit options win. Change the value later with meson configure, not by editing meson.build.