Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC/RFA] continue stepping if landed in new range of same line
Date: Fri, 21 Dec 2007 14:01:00 -0000	[thread overview]
Message-ID: <20071221132401.GA22244@caradoc.them.org> (raw)
In-Reply-To: <20071221060730.GM6184@adacore.com>

On Fri, Dec 21, 2007 at 10:07:30AM +0400, Joel Brobecker wrote:
> I am wondering what emacs would do with the following example:
> 
>     void increment (int *a, int *b) { *a = *a + 1; *b = *b + 1; }
> 
> I wanted to try, but I must be missing something in my setup as
> emacs doesn't indent either cases.

You should just need to be in c-mode.  Might need
(c-toggle-auto-state 1) too (C-c C-a).

void increment (int *a, int *b)
{
  *a = *a + 1;
  *b = *b + 1;
}

(I was wrong about it being perfect; still, pretty good)
 
> I think that the debugger would need the help of the compiler in order
> to be able to do that. With the example above, I get the following code
> on x86:

Ideally we'd combine this with the is_stmt flag and column number
support, and put a caret where we wanted.

> Indeed, when I deactived the code that checks for the last line
> in our function, here is the new behavior:
> 
>     (gdb) b *increment
>     Breakpoint 1 at 0x80483c0: file f.c, line 1.
>     (gdb) run
>     Starting program: /home/no-backup/brobecke/next/C/g 
>     
>     Breakpoint 1, increment (a=0xbfd16d60, b=0xbfd16d5c) at f.c:1
>     1       void increment (int *a, int *b) { *a = *a + 1; *b = *b + 1; }
>     (gdb) n
>     main () at g.c:12
>     12        printf ("a = %d, b = %d\n", a, b);
> 
> Before I disabled this code, GDB would stop at line f.c:1 one more
> time before landing back in the caller.
> 
> Perhaps if this is a requirement, we might want to add a testcase
> for it in our testsuite.  Optimization is not necessary in order
> to reproduce this...  Just for kicks, I ran the testsuite with
> the disabled code, to see if anything would fail because of it,
> and not unexpectedly, nothing did...

To be honest, I find this behavior a bit surprising.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2007-12-21 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-19 12:59 Joel Brobecker
2007-12-19 14:18 ` Daniel Jacobowitz
2007-12-20  5:40   ` Joel Brobecker
2007-12-20 14:08     ` Daniel Jacobowitz
2007-12-21  6:28       ` Joel Brobecker
2007-12-21 14:01         ` Daniel Jacobowitz [this message]
2007-12-22  6:03           ` Joel Brobecker
2007-12-22 18:05             ` Daniel Jacobowitz
2007-12-24  6:41               ` Joel Brobecker

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=20071221132401.GA22244@caradoc.them.org \
    --to=drow@false.org \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@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