Skip to main content

What does bkpt mean?

·282 words·2 mins

In this first post I will explain where the name bkpt comes from. My professional programming journey started with ARM Cortex based microcontrollers. My debugging tool of choice was GDB connected through SWD (Serial Wire Debug) protocol to the microcontroller.

As my programs became bigger and more complex I started to introduce assertions to verify certain conditions were met at entry or exit of a function for example. Typically my asserts where implemented something like this:

#ifdef _DEBUG
  #define ASSERT(x) if(!(x)) { __asm__("bkpt"); }
#else
  #define ASSERT(x)
#endif

Here, __asm__ is a special keyword to add inline assembly to your C program. For the ARM Cortex processors the bkpt instruction is described as ‘Breakpoint’. As soon as the processor encounters this instruction it will halt its execution immediately. With GDB attached, I then can examine the values of the variables or hardware registers that caused the assertion to fail.

This technique allowed me to effectively find edge cases not handled correctly and only occurring occasionally, because during my development cycles, these asserts were always enabled. Furthermore, it allowed me to find bugs quickly, or even prevented them from actually becoming a bug before I was done developing a feature. When looking for a domain name to start writing blog posts about programming, the name of this assembly instruction is what came to mind first.

So here we are today, my personal blog is hosted on bkpt.eu, pronounced by me as breakpoint.eu. At the time of writing, breakpoint.eu is for sale by a domain trader. And personally, I don’t like these kind of trading companies. But well, I have a much cooler (and probably harder to remember) domain name that means the same.

Pasquale van Heumen
Author
Pasquale van Heumen
Software Engineer