Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change executing thread in gdb?

Tags:

linux

gdb

kgdb

I'm currently debugging kernel code using KGDB. Whenever I break in I naturally jump to the interrupt handler for kgdb. Under GDB I ran the following command.

info threads 

and the output would be

7    Thread 7 (rcu_sched) 0x0000000000000000 in irq_stack_union ()

6    Thread 5 (kworker/0:0H) 0x0000000000000000 in irq_stack_union ()

5    Thread 3 (ksoftirqd/0) 0x0000000000000000 in irq_stack_union ()

4    Thread 2 (kthreadd) 0x0000000000000000 in irq_stack_union ()

3    Thread 1 (init)   0x0000000000000000 in irq_stack_union ()

2    Thread 3754 (Xorg) 0x0000000000000000 in irq_stack_union ()

* 1    Thread 4294967294 (shadowCPU0) kgdb_breakpoint ()

    at kernel/debug/debug_core.c:1042

I would then jump through the code expecting to end up in a different thread (I'm interested in Xorg) however after i step through the code the next executing thread becomes cpu idle.

info thread

* 1    Thread 4294967294 (shadowCPU0) cpu_idle_loop () at kernel/cpu/idle.c:116

How can I switch my debug context to Xorg or any other thread, additionally what does irq_stack_union () mean. Thread is idle pending interrupts?

like image 251
RandomGuy Avatar asked Mar 11 '26 08:03

RandomGuy


1 Answers

According to the offical documentation is is just thread threadno https://sourceware.org/gdb/onlinedocs/gdb/Threads.html

like image 183
Koogle Avatar answered Mar 14 '26 01:03

Koogle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!