Sometimes you don’t get to use a debugger. When do bare metal development, often it is faster to get to the root of a problem by throwing in trace statements, and seeing what path is taken through the code.
There are two main techniques I have been using to do this. The first is to print out the spot in the code using built in macros that tell the file, the name of the function, and the line number. That looks like this:
pr_info("%s %s %d", __FILE__, __func__, __LINE);
I know it looks a little weird having some upper and some lower case in there, but that is what works.
However, Linux makes heavy use of function pointers, and you cannot use tags to jump to a function whose name you do not know. To print out the source of a function from a pointer, you can use the print formatting macros specific to the Linux Kernel. For example: I can use
In my case, that prints out:
Which I could then jump to using the :tag command in vim.