public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] generic show_stack facility
@ 2002-03-29 15:23 Christoph Hellwig
  2002-03-29 15:46 ` David Mosberger
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2002-03-29 15:23 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: Andrew Morton, linux-kernel

This patch adds a prototype for show_stack to sched.h and exports
it.  Andrea's VM updates want this, as does Tux and I think it's a facility
we want to proive genericly.

Note that some architectures (e.g. ia64) have a conflicting prototype and
some (e.g. sparc) don't have show_stack at all, but I think -pre5 is early
enough in the 2.4.19 cycle to let the maintainers fix it.

Could you apply the patch to your tree?

	Christoph

diff -uNr -Xdontdiff ../master/linux-2.4.19-pre4/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c
--- ../master/linux-2.4.19-pre4/arch/i386/kernel/irq.c	Wed Nov  7 20:09:56 2001
+++ linux/arch/i386/kernel/irq.c	Fri Mar 29 15:55:39 2002
@@ -192,8 +192,6 @@
 unsigned char global_irq_holder = NO_PROC_ID;
 unsigned volatile long global_irq_lock; /* pendantic: long for set_bit --RR */
 
-extern void show_stack(unsigned long* esp);
-
 static void show(char * str)
 {
 	int i;
@@ -224,7 +222,7 @@
 		}
 		esp &= ~(THREAD_SIZE-1);
 		esp += sizeof(struct task_struct);
-		show_stack((void*)esp);
+		show_stack((void *)esp);
  	}
 	printk("\nCPU %d:",cpu);
 	show_stack(NULL);
diff -uNr -Xdontdiff ../master/linux-2.4.19-pre4/arch/ia64/kernel/irq.c linux/arch/ia64/kernel/irq.c
--- ../master/linux-2.4.19-pre4/arch/ia64/kernel/irq.c	Thu Mar 21 15:24:10 2002
+++ linux/arch/ia64/kernel/irq.c	Fri Mar 29 15:56:13 2002
@@ -192,8 +192,6 @@
 unsigned int global_irq_holder = NO_PROC_ID;
 unsigned volatile long global_irq_lock; /* pedantic: long for set_bit --RR */
 
-extern void show_stack(unsigned long* esp);
-
 static void show(char * str)
 {
 	int i;
diff -uNr -Xdontdiff ../master/linux-2.4.19-pre4/arch/mips/kernel/traps.c linux/arch/mips/kernel/traps.c
--- ../master/linux-2.4.19-pre4/arch/mips/kernel/traps.c	Thu Mar 21 15:24:13 2002
+++ linux/arch/mips/kernel/traps.c	Fri Mar 29 15:53:53 2002
@@ -182,12 +182,12 @@
  * This routine abuses get_user()/put_user() to reference pointers
  * with at least a bit of error checking ...
  */
-void show_stack(unsigned int *sp)
+void show_stack(unsigned long *sp)
 {
 	int i;
-	unsigned int *stack;
+	unsigned long *stack;
 
-	stack = sp ? sp : (unsigned int *)&sp;
+	stack = sp ? sp : (unsigned long *)&sp;
 	i = 0;
 
 	printk("Stack:");
diff -uNr -Xdontdiff ../master/linux-2.4.19-pre4/include/linux/sched.h linux/include/linux/sched.h
--- ../master/linux-2.4.19-pre4/include/linux/sched.h	Thu Mar 21 15:24:23 2002
+++ linux/include/linux/sched.h	Fri Mar 29 15:59:51 2002
@@ -145,6 +145,7 @@
 extern void sched_init(void);
 extern void init_idle(void);
 extern void show_state(void);
+extern void show_stack(unsigned long *esp);
 extern void cpu_init (void);
 extern void trap_init(void);
 extern void update_process_times(int user);
diff -uNr -Xdontdiff ../master/linux-2.4.19-pre4/kernel/ksyms.c linux/kernel/ksyms.c
--- ../master/linux-2.4.19-pre4/kernel/ksyms.c	Thu Mar 21 15:24:23 2002
+++ linux/kernel/ksyms.c	Fri Mar 29 15:52:20 2002
@@ -487,6 +487,7 @@
 EXPORT_SYMBOL(seq_release);
 EXPORT_SYMBOL(seq_read);
 EXPORT_SYMBOL(seq_lseek);
+EXPORT_SYMBOL(show_stack);
 
 /* Program loader interfaces */
 EXPORT_SYMBOL(setup_arg_pages);

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: [PATCH] generic show_stack facility
@ 2002-03-30  3:05 Keith Owens
  2002-03-30  3:31 ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Keith Owens @ 2002-03-30  3:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Christoph Hellwig, davidm, Marcelo Tosatti, linux-kernel

On Fri, 29 Mar 2002 10:41:11 -0800, 
Andrew Morton <akpm@zip.com.au> wrote:
>Christoph Hellwig wrote:
>> 
>> On Fri, Mar 29, 2002 at 09:36:26AM -0800, Andrew Morton wrote:
>> > Here's the diff.  Comments?
>> 
>> I don't see who having to independand declaration in the same kernel
>> image are supposed to work..
>
>It goes in lib/lib.a.  The linker will only pick up
>the default version if the architecture doesn't
>have its own dump_stack().
>
>bust_spinlocks() has worked that way for quite some time.

I have a problem with putting routines in lib.a and relying on the
linker to pull them out by default.  It does not work for routines
called from modules, modules do not include lib.a.  Remember the recent
problems with crc32.o?

bust_spinlocks() is not an issue because it is only called from built
in code.  show_stack() has been used as a debugging facility and it
could be called from a module.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-03-30 12:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-29 15:23 [PATCH] generic show_stack facility Christoph Hellwig
2002-03-29 15:46 ` David Mosberger
2002-03-29 16:06   ` Christoph Hellwig
2002-03-29 17:08     ` David Mosberger
2002-03-29 17:16       ` arjan
2002-03-29 18:25         ` David Mosberger
2002-03-30 10:06           ` Kai Henningsen
2002-03-29 17:36       ` Andrew Morton
2002-03-29 18:26         ` David Mosberger
2002-03-29 18:34         ` Christoph Hellwig
2002-03-29 18:41           ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2002-03-30  3:05 Keith Owens
2002-03-30  3:31 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox