Re: Why dump_stack results different so much?

From: Xin Zhao
Date: Fri Jul 29 2005 - 16:08:24 EST


Thanks for your reply.

Below is the code that print the kernel calling trace:

/**********************************************************************************/
void show_trace(struct task_struct *task, unsigned long * stack)
{
unsigned long ebp;

if (!task)
task = current;

if (task == current) {
/* Grab ebp right from our regs */
asm ("movl %%ebp, %0" : "=r" (ebp) : );
} else {
/* ebp is the last reg pushed by switch_to */
ebp = *(unsigned long *) task->thread.esp;
}

while (1) {
struct thread_info *context;
context = (struct thread_info *)
((unsigned long)stack & (~(THREAD_SIZE - 1)));
ebp = print_context_stack(context, stack, ebp);
stack = (unsigned long*)context->previous_esp;
if (!stack)
break;
printk(" =======================\n");
}
}
/**********************************************************************************/

>From this code, I can see that the show_trace does not scan and guess
the pointers. Instead, it use "previous_esp" to extract the esp and
thus the returning eip. Am I right?

Cheers,
xin




On 7/29/05, bert hubert <bert.hubert@xxxxxxxxxxxxx> wrote:
> On Fri, Jul 29, 2005 at 04:27:16PM -0400, Xin Zhao wrote:
> > I supprisely noticed that the dump_stack results are quite different!
> > Why did I get the calling traces below our_ssy_open() and above
> > syscall_call()? Any thought on this? Many thanks!
>
> This might depend on compiling with frame pointers, or not. I recall that at
> one point, the kernel did a basic scan of addresses that looked like likely
> candidates to have been pointers, and printed those.
>
> Frame pointers are hailed as improving backtraces. They are in the 'kernel
> hacking' section of the kernel configuration.
>
> Sorry that I can't be more precise, but try turning on frame pointers.
>
> Good luck!
>
> --
> http://www.PowerDNS.com Open source, database driven DNS Software
> http://netherlabs.nl Open and Closed source services
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/