public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: dual line backtraces for i386.
@ 2006-01-05 18:18 Chuck Ebbert
  2006-01-05 21:28 ` Dave Jones
  0 siblings, 1 reply; 8+ messages in thread
From: Chuck Ebbert @ 2006-01-05 18:18 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel

In-Reply-To: <20060105062208.GA12095@redhat.com>

On Thu, 5 Jan 2006 at 01:22:08 -0500, Dave Jones wrote:

> --- linux-2.6.15/arch/i386/kernel/traps.c~    2005-12-01 04:25:36.000000000 -0500
> +++ linux-2.6.15/arch/i386/kernel/traps.c     2005-12-01 04:36:19.000000000 -0500
> @@ -116,6 +116,7 @@ static inline unsigned long print_contex
>                               unsigned long *stack, unsigned long ebp)
>  {
>       unsigned long addr;
> +     char space=0;

        char space = 0;


> -                     printk("\n");
> +                     if (space == 0) {
> +                             printk("    ");
> +                             space = 1;
> +                     } else {
> +                             printk("\n");
> +                             space = 0;
> +                     }

Why not:

                        printk(space == 0 ? "     " : "\n");
                        space = !space;


> +     if (space==1)
> +             printk("\n");

        if (space == 1)

-- 
Chuck
Currently reading: _Thud!_ by Terry Pratchett

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: dual line backtraces for i386.
@ 2006-01-06 18:36 Chuck Ebbert
  2006-01-06 19:17 ` Jan Engelhardt
  0 siblings, 1 reply; 8+ messages in thread
From: Chuck Ebbert @ 2006-01-06 18:36 UTC (permalink / raw)
  To: Dave Jones; +Cc: linux-kernel

In-Reply-To: <20060105212802.GR20809@redhat.com>

On Thu, 5 Jan 2006 at 16:28:02 -0500, Dave Jones wrote:

> > Why not:
> > 
> >                         printk(space == 0 ? "     " : "\n");
> >                         space = !space;
>
> readability ?

Well, if I were going for _un_readability I'd have suggested:

        printk(space = !space ? "     " : "\n");

:)

> Personally, I despise the ternary operator, because it makes me
> stop to try to parse it every time I see it.

I think it's a psychological thing because it makes you spend as
much time parsing a single line as it would to parse a whole
if-then-else and it just feels wrong somehow.

> With the code I wrote
> it's blindlingly obvious what is going on.

For simple espressions I think it's about the same, but like you said
it's a personal thing.  A soon as you start nesting cases the 'if'
becomes much clearer.  (People who nest ternary expressions should
be taken out and shot.)
-- 
Chuck
Currently reading: _Thud!_ by Terry Pratchett

^ permalink raw reply	[flat|nested] 8+ messages in thread
* dual line backtraces for i386.
@ 2006-01-05  6:22 Dave Jones
  0 siblings, 0 replies; 8+ messages in thread
From: Dave Jones @ 2006-01-05  6:22 UTC (permalink / raw)
  To: linux-kernel

Another 'get better debug info from users' patch.
x86-64 has had this since day one, and I don't know why
no-one ever ported it to i386.

Instead of using one line per function call in the backtrace,
we can fit two per line.

Signed-off-by: Dave Jones <davej@redhat.com>

--- linux-2.6.15/arch/i386/kernel/traps.c~	2005-12-01 04:25:36.000000000 -0500
+++ linux-2.6.15/arch/i386/kernel/traps.c	2005-12-01 04:36:19.000000000 -0500
@@ -116,6 +116,7 @@ static inline unsigned long print_contex
 				unsigned long *stack, unsigned long ebp)
 {
 	unsigned long addr;
+	char space=0;
 
 #ifdef	CONFIG_FRAME_POINTER
 	while (valid_stack_ptr(tinfo, (void *)ebp)) {
@@ -131,9 +132,17 @@ static inline unsigned long print_contex
 		if (__kernel_text_address(addr)) {
 			printk(" [<%08lx>]", addr);
 			print_symbol(" %s", addr);
-			printk("\n");
+			if (space == 0) {
+				printk("    ");
+				space = 1;
+			} else {
+				printk("\n");
+				space = 0;
+			}
 		}
 	}
+	if (space==1)
+		printk("\n");
 #endif
 	return ebp;
 }

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

end of thread, other threads:[~2006-01-07 11:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-05 18:18 dual line backtraces for i386 Chuck Ebbert
2006-01-05 21:28 ` Dave Jones
  -- strict thread matches above, loose matches on Subject: below --
2006-01-06 18:36 Chuck Ebbert
2006-01-06 19:17 ` Jan Engelhardt
2006-01-06 19:33   ` Bob Copeland
2006-01-07  0:00     ` Mitchell Blank Jr
2006-01-07 11:16       ` Jan Engelhardt
2006-01-05  6:22 Dave Jones

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