Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: Marc Khouzam <marc.khouzam@ericsson.com>
Cc: gdb@sourceware.org
Subject: Re: ProcessRecord problem with recursion
Date: Sat, 21 Mar 2009 08:54:00 -0000	[thread overview]
Message-ID: <daef60380903210154g532d541bod7dc6d27aa66f80c@mail.gmail.com> (raw)
In-Reply-To: <6D19CA8D71C89C43A057926FE0D4ADAA07152198@ecamlmw720.eamcs.ericsson.se>

Hi Marc,

I had post a patch for it in
http://sourceware.org/ml/gdb-patches/2009-03/msg00428.html

Thanks,
Hui

On Fri, Mar 20, 2009 at 09:13, Marc Khouzam <marc.khouzam@ericsson.com> wrote:
> Hi,
>
> I'm having problems with ProcessRecord and recursion.
> It looks like the reverse-next operation behaves like
> reverse-step when dealing with a recursive method.
>
> I have GDB HEAD from the 18th of March, with the patches included in
> http://sourceware.org/ml/gdb-patches/2009-03/msg00375.html
> http://sourceware.org/ml/gdb-patches/2009-03/msg00005.html
> http://sourceware.org/ml/gdb-patches/2009-01/msg00444.html
>
> Here is a program and session that shows the problem:
>
> GNU gdb (GDB) 6.8.50.20090318-cvs
> [...]
> (gdb) l
> 1       int factorial(int x) {
> 2          if (x == 1) return 1;
> 3          int result = x * factorial(x-1);
> 4          return result;
> 5       }
> 6
> 7       int main() {
> 8           factorial(5);
> 9           return 0;
> 10      }
> (gdb) start
> Temporary breakpoint 1 at 0x804847b: file a.cc, line 8.
> Starting program: /local/home/lmckhou/testing/a.out
>
> Temporary breakpoint 1, main () at a.cc:8
> 8           factorial(5);
> (gdb) rec
> (gdb) s
> factorial (x=5) at a.cc:2
> 2          if (x == 1) return 1;
> (gdb) n
> 3          int result = x * factorial(x-1);
> (gdb) n
> 4          return result;
> (gdb) rn
> factorial (x=4) at a.cc:5
> 5       }
>
> Notice how the reverse-next(rn) command jumped to the end
> of the next factorial method on the stack (x=4 instead of x=5).
>
> Thanks
>
> Marc
>
>


  parent reply	other threads:[~2009-03-21  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-20  1:18 Marc Khouzam
2009-03-20  3:10 ` Hui Zhu
2009-03-21  8:54 ` Hui Zhu [this message]
2014-03-07  2:37 jian shen

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=daef60380903210154g532d541bod7dc6d27aa66f80c@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=marc.khouzam@ericsson.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