printf() debug code

7 views
Skip to first unread message

Buzz McCool

unread,
Mar 10, 2020, 11:56:58 AM3/10/20
to
On 1/29/20 10:47 PM, Eli the Bearded wrote:
> The crud that clogs my crennelations is, I suspect, caked Bon Ami
> ("Hasn't Scratched Yet") which we use for various kitchen cleaning.
> Make a paste and mortar it in and that might work if the cable hack ever
> fails.

The above got me thinking about a better gas stove burner hack. I took
the smallest ring lug I had, stripped off the plastic collar, and then
put it in between the crenelations, like a cannon  poking out from a
castle. Bending over the ring further limits the natural gas while also
securing the smaller orifice in place. I sawed off the cannon tip to
make sure it wasn't too close to the spark igniter. Now the burner
lights on the very first spark of the built-in lighter.

On 1/29/20 10:47 PM, Eli the Bearded wrote:
> I like keeping notes along side source code. Things like a diff that
> adds a lot of printf() debugging code; ...

ObHack:

As far as printf() debugging code, I keep all code in one file and
separate the debug only portions with ifdefs. In my Makefile, I compile
"release" code in one directory for customers, and "debug" code for
internal debugging in another:

#
# Project Directories
#
RELDIR := release
DBGDIR := debug

# Executable
EXE := my_app

RELEXE := $(RELDIR)/$(EXE)
DBGEXE := $(DBGDIR)/$(EXE)

#
# Release compiler options
#
# -DNDEBUG  -> compiles "#ifdef NDEBUG" code
# -O3       -> Optimize executable to a very high level
RELC_OPTIONS := -DNDEBUG
RELC_OPTIONS += -O3


#
# Debug compiler options
#
# -ggdb     -> Produce debugging information for use by the GNU Debugger
(GDB)
# -DDEBUG   -> compiles "#ifdef DEBUG" code
# -Og       -> Enable optimizations that do not interfere with debugging.
DBGC_OPTIONS :=  -ggdb
DBGC_OPTIONS += -DDEBUG
DBGC_OPTIONS += -Og

#
# Rules
#

# ### Rule to make release and debug executable and object files ###
.PHONY: all
all: release debug

release: $(RELEXE)

(RELC_OPTIONS used in here)

debug: $(DBGEXE)

(DBGC_OPTIONS used in here)

.
.
.

Buzz
Reply all
Reply to author
Forward
0 new messages