Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Alex Bennee <kernel-hacker@bennee.com>
To: gdb@sources.redhat.com
Subject: Why can't I use "info line *address" in canned scripts?
Date: Thu, 30 Jan 2003 15:50:00 -0000	[thread overview]
Message-ID: <1043941567.1948.8.camel@cambridge.braddahead> (raw)

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.


             reply	other threads:[~2003-01-30 15:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-30 15:50 Alex Bennee [this message]
2003-01-30 17:22 ` Andreas Schwab
2003-01-30 17:42   ` Alex Bennee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1043941567.1948.8.camel@cambridge.braddahead \
    --to=kernel-hacker@bennee.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox