I have CodeWarrior & CodeWarrior Tap and I want to debug a kernel module, and I am having
some difficulty in understanding...
I have read
* targeting manual (https://www.nxp.com/docs/en/user-guide/CWARMv8TM.pdf
* debugging manual (CodeWarrior for ARMv8 to Debug )
* and this one old application note: (https://www.nxp.com/docs/en/application-note/AN4980.pdf )
How do I set a breakpoint in my kernel module?
In gdb before doing the insmod - I did:
It did see the symbols, but it didn't break inside of the init_module routine...
I've also edited the debug configuration to "suspend target when module is insert or removal"
and waited until Linux is done with all the built-in modules, and then start CW (so the first insmod
will be my module).....It suspended, but not @ my init_module (which I also tried to set a break point)
Kernel Awareness: Module Breakpoint init is hit
INFO: auto-loading symbolics
INFO: symbol file /home/tom/plkSrc/build_dir/target-aarch64_generic_musl/root-layerscape/lib/modules/4.14.162/plk1000e.ko loaded successfully
[CW-INFO]Successfully loaded symbols for module plk1000e
[CW-INFO]Detected read-only areas inside module. Using hardware
breakpoints inside those ranges.
[Switching to Thread 2]
Thread 2 hit Breakpoint -1, do_init_module (mod=0xffff000000b0c3c0 <__this_module>) at ./include/linux/slab.h:488
488 return kmem_cache_alloc_trace(kmalloc_caches[index],
I've seen a couple old videos, but is there a more modern Application Note that tells me
how to do this with the modern cw tap (i.e.: there doesn't seem to be an OS Resources view in debug)
Please refer to section "220.127.116.11 Module debugging use cases" in C:\Freescale\CW4NET_v2019.01\CW_ARMv8\ARMv8\Help\PDF\ARMv8_Targeting_Manual.pdf.
Breakpoints in module’s source code or at a specific module function can be set at any time, even the module symbols file is not loaded into the debugger.If the module’s symbols file is loaded, the breakpoint is set/enabled and the module relocation address is displayed in the breakpoint properties.
(gdb) break krng_mod_initBreakpoint 3 at 0xffffffbffc03a000: file crypto/krng.c, line 50.
(gdb) info breakpoints Num Type Disp Enb Address What3 breakpoint keep y 0xffffffbffc03a000 in krng_mod_init at crypto/krng.c:50