Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Nan Xiao" <xiaonan19830818@qq.com>
To: gdb <gdb@sourceware.org>
Subject: How to use "frame addr" command in gdb?
Date: Wed, 19 Nov 2014 05:46:00 -0000	[thread overview]
Message-ID: <tencent_375579DA7B8E36B268074E90@qq.com> (raw)

Hi all,

I know there are 2 commands for selecting frame: "frame n" and "frame addr"(Selecting a Frame in gdb manual). And write a simple program to test the 2 commands.

The program is like this:

#include <stdio.h>

int func1(int a)
{
        return 2 * a;
}

int func2(int a)
{
        int c = 0;
        c = 2 * func1(a);
        return c;
}

int func3(int a)
{
        int c = 0;
        c = 2 * func2(a);
        return c;
}

int main(void)
{
        printf("%d\n", func3(10));
        return 0;
}

I use gdb to debug this program, and find 'frame n' command works OK:
(gdb) bt
#0  func1 (a=10) at a.c:5
#1  0x08050b67 in func2 (a=10) at a.c:11
#2  0x08050b89 in func3 (a=10) at a.c:18
#3  0x08050bb9 in main () at a.c:24
(gdb) frame 2
#2  0x08050b89 in func3 (a=10) at a.c:18

But when I want to use "frame addr" command, it seems not work well:

(gdb) frame 0x08050bb9
#0  0x00000000 in ?? ()
(gdb) frame 0x08050b89
#0  0x00000000 in ?? ()
(gdb) frame 0x08050b92
#0  0x00000000 in ?? ()

How to use "frame addr" command? Thanks very much in advance! I can't find other reference except the manual.

P.S. My gdb is 7.8.1, and works on Solaris X86 platform.

Best Regards
Nan Xiao

             reply	other threads:[~2014-11-19  5:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19  5:46 Nan Xiao [this message]
     [not found] ` <874mtvhegh.fsf@codesourcery.com>
2014-11-19  7:09   ` =?gb18030?B?TmFuIFhpYW8=?=

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=tencent_375579DA7B8E36B268074E90@qq.com \
    --to=xiaonan19830818@qq.com \
    --cc=gdb@sourceware.org \
    /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