Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch] Workaround gcc bug 49906
Date: Sat, 29 Oct 2011 09:21:00 -0000	[thread overview]
Message-ID: <20111029082300.GA17020@host1.jankratochvil.net> (raw)
In-Reply-To: <4EAB43E4.4050004@qnx.com>

On Sat, 29 Oct 2011 02:08:04 +0200, Aleksandar Ristovski wrote:
> if we are
> talking about what would be intuitive, then I think the very first
> line of code must be 'for' loop (even if it evaluates to 'nop').
> 
> Consider this test (which is what I was concentrating on):
> 
> (gdb) b foo
> Breakpoint 1 at 0x4004ba: file foo.c, line 8.
> (gdb) list foo
> 1       static int i;
> 2       static void
> 3       foo(void)
> 4       {
> 5         for (;;)
> 6               if (i++)
> 7                 break;
> 8       }
> 9
> 10
> 
> Line 8 is totally unintuitive and weird.

I agree line 8 is wrong, this is what is filed as GCC PR debug/49906.

The question is whether the right line is 6 or whether it should be 5.

If it is 5 with so many nops everywhere I am not sure the debugging is more
comfortable.  IMO when one does "step" one expects some changes in the
inferior happen.


> In any case, I will revisit the whole thing paying attention to your
> test case - maybe there is no generic solution, but then again, I
> would choose the less bad solution over the plain broken one.

It is questionable how hard it should be pushed for in GDB when the right fix
should be done in GCC anyway (I pinged Dodji Seketeli for it yesterday).

My most serious concern is the workaround should not affect any correctly
produced debuginfo (by non-GCC or future GCC compilers).  If there is no other
way than a hack with side-effects then it is IMHO more suitable for vendor
branches of GDB (I make sometimes such hacks in Fedora Rawhide for fresh
GCCs).

There is for example a possibility to make the workaround arch-dependent
finding the last jump instruction and breaking on it, I made a similar
.debug_line workaround recently which should have no side-effects:
	[patch] workaround gcc46: prologue skip skips too far (PR 12435) #2
	http://sourceware.org/ml/gdb-patches/2011-07/msg00645.html


Thanks,
Jan


  reply	other threads:[~2011-10-29  8:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-25 18:12 Aleksandar Ristovski
2011-10-28 21:00 ` Jan Kratochvil
2011-10-28 21:23   ` Aleksandar Ristovski
2011-10-28 22:15     ` Jan Kratochvil
2011-10-29  0:10       ` Aleksandar Ristovski
2011-10-29  9:21         ` Jan Kratochvil [this message]
2011-10-29  1:31       ` Aleksandar Ristovski

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=20111029082300.GA17020@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=aristovski@qnx.com \
    --cc=gdb-patches@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