Tracking process program counter in kernel

Guru Prasad <[email protected]> Thu, 25 Sep 2014 01:49:17 -0400
Newsgroups org.kernel.vger.linux-newbie
Message-ID <CAMefCkDp4D+K8fMKx+bDzA5SsOiRaK3F_ACkHkOX+yOnFZKrSQ@mail.gmail.com>
I'm trying to track the value of the PC of a particular process within
the kernel.
To do this, I looked at the kernel source and figured out that the pc
is being stored inside task_struct->stack and that to make sense of
the stack, I need to type cast it into struct thread_info *.
Therefore, in in gdb, I set a breakpoint b scheduler_tick (called every 10ms).
However, when I printed out p/x ((struct thread_info
*)curr->stack)->cpu_context.pc, I received the value as `$4 =
0x804d19d8`.

I expected the PC to be below 0x80000000 given that addresses above
0x80000000 are configured to be kernel-space in my kernel. Upon
looking at the objdump output of the kernel, I see that the pc was
pointing to __schedule.

Correct me if I'm wrong, but isn't the PC supposed to be pointing to
user-space instructions for a process that I started from user-space?
My understanding was that, when an interrupt is triggered, the
register state is saved, the interrupt is serviced, and then the
register state is restored so the program continues as though
'nothing' happened.

How can I find the current instruction that is being executed in user-space?
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs