vampirefrog has quit [Remote host closed the connection]
vampirefrog has joined #openocd
jn has quit [Ping timeout: 252 seconds]
jn has joined #openocd
jn has joined #openocd
PaulFertser has quit [Ping timeout: 260 seconds]
PaulFertser has joined #openocd
Hawk777 has joined #openocd
tsal has quit [Ping timeout: 264 seconds]
tsal has joined #openocd
nerozero has joined #openocd
balrog has quit [Ping timeout: 256 seconds]
balrog has joined #openocd
ayaka__ has joined #openocd
<ayaka__>
I met a problem with debugger linux kernel module, but the gdb can't never stop where I want, it always bother me with arm psci error https://paste.centos.org/view/d47269d8
<ayaka__>
the gdb info breakpoints always be pending, even I have add the modules' text addresses
<PaulFertser>
ayaka__: you might want to try "hbreak" to force hardware breakpoints but I have no idea about psci :( also there's the usual advice of disabling idle etc when debugging Linux over JTAG.
<ayaka__>
PaulFertser, psci is a annoying arm firmware running a separate cpu execute level(not kernel, not userspace, but a monitor level)
<ayaka__>
I tried to lx-symbols, which would load kernel modules auto, then I can't resume kernel to run
<PaulFertser>
ayaka__: you can try using "hbreak" instead of "break" to avoid modifying memory.
<borneoa___>
ayaka__: the abort message after GDB connect looks like the debugger failed to connect or halt the target. Is there any other message at OpenOCD starting?
<borneoa___>
ayaka__: there is also a command "monitor gdb_breakpoint_override hard" to force OpenOCD to only use HW breakpoints
<ayaka__>
PaulFertser, yes, I would try to when I figured out how to disable kaslr
<borneoa___>
ayaka__: can you post the OpenOCD log from OpenOCD start till GDB attach?
<ayaka__>
borneoa___, should I let the gdb loading kernel modules symbols?
<borneoa___>
ayaka__: then you can also increase the log level and dump GDB communication. Add -d to OpenOCD command line ans run "set debug remote 1" in GDB before connecting to OpenOCD
<ayaka__>
of course, I would follow you
cp- has joined #openocd
<ayaka__>
RANDOMIZE_BASE is n in my kernel config, I think I didn't enable kaslr
<borneoa___>
ayaka__: yes! Load kernel symbols before connecting to OpenOCD otherwise GDB issues crap random read to the target to guess the stack structure and you get endless abort msgs due to memory protection, plus the secure firmware should detect the illegal memory access and hang or reboot the platform
<ayaka__>
paste.centos.org/view/12ec5183
<ayaka__>
it is breakpoint_add_internal() make this problem, for gdb it is Cannot access memory at address 0xffffffc0080da6a0 . Maybe I should figure out a method to disable rodata
<borneoa___>
ayaka__: I see you have set -rtos linux. Have you patched OpenOCD and recompiled it to align it with your kernel?
<ayaka__>
borneoa___, nope, I didn't patch the openocd, I didn't know I should do that
<borneoa___>
ayaka__: there is a compile flag to disable rodata, search it around the command line flag rodata=off
<borneoa___>
ayaka__: I'm going offline for ~30 minutes...
<borneoa___>
ayaka__: eventually drop rtos linux for the moment and eventually use the GDB script in the kernel
<ayaka__>
you mean using gdb with qemu? unfortunately I want to debug it in a real hardware
cp- has quit [Ping timeout: 276 seconds]
cp- has joined #openocd
<ayaka__>
unfortunately, ARCH_HAS_STRICT_KERNEL_RWX in arm64, I think I have to figure out a method to insert the bootargs
Hawk777 has quit [Quit: Leaving.]
<ayaka__>
After I turn off the rodata and decrease the adapter speed, I could finally resume the cpu
<ayaka__>
but still the kernel breakpoint won't work. Besides I must resume kernel quickly after the gdb halt the kernel or kernel would kill that kernel
Haohmaru has joined #openocd
MGF_Fabio has joined #openocd
<borneoa___>
ayaka__: the flag to disable is CONFIG_STRICT_KERNEL_RWX
<ayaka__>
borneoa___, yes, but that flag is not visual when ARCH_HAS_STRICT_KERNEL_RWX so I disable the rodata in dts which applied to the command line
<ayaka__>
but I still can't make the breakpoint work for the kernel
<borneoa___>
ayaka__: no, I'm not suggesting qemu. You have mentioned the command lx-symbols that is a GDB extension provided by a python script distributed in kernel code; it's the GDB awareness script. Linaro has developed it to somehow replace OpenOCD -rtos linux because it's not available in qemu and even in OpenOCD is hard to use it. So, I suggest to use it in place of OpenOCD rtos
<ayaka__>
borneoa___, if I use the vmlinux-gdb.py, I should use hwthread in openocd instead?
<borneoa___>
ayaka__: yes
<borneoa___>
ayaka__: you are right, arm64 doesn't allow that flag.
<ayaka__>
let me try whether it would help
<borneoa___>
ayaka__: to simplify the debug, keep only one core enabled and halt the others. In this way you can skip hwthread and SMP. I mean stop the core from executing the kernel and become like single CPU
<ayaka__>
borneoa___, for the trial stage, that maybe enough. But the problem I need to debug is a about multiple threads
<borneoa___>
ayaka__: just temporarily. Either recompile with no SMP or stop the CPU with echo 0 > /sys/bus/cpu/devices/cpu1/online
<ayaka__>
I tried, the gdb has no problem on halting or resume the cpu now. But the breakpoint still won't work
<ayaka__>
it is quite strange, I tried the watchpoint API from the linux kernel last time, it would work
<ayaka__>
I just can't insert a hardware point? Or maybe the TEE OS(open-tee) here clear the hardware breakpoint ?
<ayaka__>
borneoa___, I think that is the problem, once I do "set breakpoint auto-hw off"
<borneoa___>
ayaka__: that page refers to self-hosted debug, that is what you get with kgdb. OpenOCD works as an external debugger. In the same page in the first paragraph there is the link to external debugger
<ayaka__>
yes, I found that. it looks like the externel debugger doesn't care about the execute level
<ayaka__>
Learning from tcl/target/stm32mp13x.cfg, I have known how to enable the access to AP after the an ap has been finished its init. But I can't create more targets after that. "Error: The 'target create' command must be used before 'init'."
<borneoa___>
ayaka__: yes targets must be created all at the start, but you can flag them as deferred examine. Once you know they are available, you can examine them. Search arp_examine in the scripts, there are few methods to use it
ayaka__ has quit [Ping timeout: 255 seconds]
gzlb has quit [Quit: WeeChat 4.1.1]
gzlb has joined #openocd
Ha0hmaru has joined #openocd
Haohmaru has quit [Read error: Connection reset by peer]
Ha0hmaru has quit [Read error: Connection reset by peer]