Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Why can't I use "info line *address" in canned scripts?
@ 2003-01-30 15:50 Alex Bennee
  2003-01-30 17:22 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Bennee @ 2003-01-30 15:50 UTC (permalink / raw)
  To: gdb

Hi,

I'm trying to get a command script to run to unwind the linux kernel
stack on a gdb remote target. I can do it manually by hand but when I
try and resolve the symbols using the "info line" command I get the
error "No line number information available for address".

I've scratched my head and can't figure out whats going on. The script
looks like this:

#
# Poor mans stack trace - trace the call history of a function given
# the current stack pointer (or assume r15 is it)
#
# It uses the same approach as the stack trace code in the kernel
#
define sym
    info line *$arg0
end

define pmst
    if $arg0 == 0
        set $sstack = $r15
    else
	set $sstack = $arg0
    end
    
    # set the bounds of text segment - can't seem to get section
    # headers so I cheat
    set $stext = &empty_zero_page
    set $etext = 0x881c6c68
    
    # and set the end of stack
    set $estack = $sstack + 1024

    printf "Doing stack strace from:%x to %x\n", $sstack, $estack
    printf "Text Segment assumed to go from:%x to %x\n", $stext, $etext
    
    # Now go through the stack and print out any
    # addresses (and where they point) that are in the
    # .text section (and therfore function returns)

    while $sstack < $estack
        set $address = *$sstack
	if $address>$stext
	    if $address<$etext
	       printf "0x%lx:", $address
	       sym ($address)
	    end
	end
	set $sstack = $sstack + 4
    end
end

And when I run it I get the following output....

(gdb) pmst $62
Doing stack strace from:881d5ec8 to 881d62c8
Text Segment assumed to go from:88001000 to 881c6c68
0x880157e8:No line number information available for address 0x880157e8
0x8801554a:No line number information available for address 0x8801554a
..
<snip>
..
0x8819c550:No line number information available for address 0x8819c550

But manually doing the info line works. 

(gdb) info line *0x880157e8
Line 524 of "printk.c" starts at address 0x880157e4
<release_console_sem+100> and ends at 0x88015800
<release_console_sem+128>.

Any ideas? Have I missed something obvious or triggered a bug?

-- 
Alex, homepage: http://www.bennee.com/~alex/

The speed of anything depends on the flow of everything.


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

* Re: Why can't I use "info line *address" in canned scripts?
  2003-01-30 15:50 Why can't I use "info line *address" in canned scripts? Alex Bennee
@ 2003-01-30 17:22 ` Andreas Schwab
  2003-01-30 17:42   ` Alex Bennee
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2003-01-30 17:22 UTC (permalink / raw)
  To: Alex Bennee; +Cc: gdb

Alex Bennee <kernel-hacker@bennee.com> writes:

|> But manually doing the info line works. 
|> 
|> (gdb) info line *0x880157e8
|> Line 524 of "printk.c" starts at address 0x880157e4
|> <release_console_sem+100> and ends at 0x88015800
|> <release_console_sem+128>.
|> 
|> Any ideas? Have I missed something obvious or triggered a bug?

What do you get when you type "info line *(0x880157e8)"?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Why can't I use "info line *address" in canned scripts?
  2003-01-30 17:22 ` Andreas Schwab
@ 2003-01-30 17:42   ` Alex Bennee
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Bennee @ 2003-01-30 17:42 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb

On Thu, 2003-01-30 at 17:22, Andreas Schwab wrote:
> Alex Bennee <kernel-hacker@bennee.com> writes:
> 
> |> But manually doing the info line works. 
> |> 
> |> (gdb) info line *0x880157e8
> |> Line 524 of "printk.c" starts at address 0x880157e4
> |> <release_console_sem+100> and ends at 0x88015800
> |> <release_console_sem+128>.
> |> 
> |> Any ideas? Have I missed something obvious or triggered a bug?
> 
> What do you get when you type "info line *(0x880157e8)"?

No problems from the command line, its in the canned scripts is causes
the problem.

(gdb) info line *0x8801b151 
Line 89 of "softirq.c" starts at address 0x8801b14c <do_softirq+108> and
ends at 0x8801b156 <do_softirq+118>.
(gdb) info line *(0x8801b151)
Line 89 of "softirq.c" starts at address 0x8801b14c <do_softirq+108> and
ends at 0x8801b156 <do_softirq+118>.
(gdb) define sym
>info line *($arg0)
>end
(gdb) pmst $1
Doing stack strace from:881d5f2c to 881d632c
Text Segment assumed to go from:88001000 to 881c6c68
0x8801b15a:No line number information available for address 0x8801b15a
<snip>

I originally thought it might be something to do with evaluation order
but the error message generated by "info line" does seem to indicate its
got the right address.

If fact experimenting further sym can be called from the command line in
many ways and still work:
(gdb) sym 0x8801b151
Line 89 of "softirq.c" starts at address 0x8801b14c <do_softirq+108> and
ends at 0x8801b156 <do_softirq+118>.
(gdb) sym (0x8801b151)
Line 89 of "softirq.c" starts at address 0x8801b14c <do_softirq+108> and
ends at 0x8801b156 <do_softirq+118>.
(gdb) set $addr=0x8801b151
(gdb) sym $addr
Line 89 of "softirq.c" starts at address 0x8801b14c <do_softirq+108> and
ends at 0x8801b156 <do_softirq+118>.
(gdb) sym ($addr)
Line 89 of "softirq.c" starts at address 0x8801b14c <do_softirq+108> and
ends at 0x8801b156 <do_softirq+118>.

But call it from within the script and it fails. I think I must be going
mad :-(


-- 
Alex, homepage: http://www.bennee.com/~alex/

All things that are, are with more spirit chased than enjoyed.
		-- Shakespeare, "Merchant of Venice"


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

end of thread, other threads:[~2003-01-30 17:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-30 15:50 Why can't I use "info line *address" in canned scripts? Alex Bennee
2003-01-30 17:22 ` Andreas Schwab
2003-01-30 17:42   ` Alex Bennee

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