Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Roland Schwingel <roland.schwingel@onevision.de>
To: gdb <gdb@sourceware.org>
Subject: gdb_assert when resetting breakpoints
Date: Tue, 10 Mar 2009 14:02:00 -0000	[thread overview]
Message-ID: <49B67300.1020503@onevision.de> (raw)

Hi...

When using current gdb cvs head sources I encounter a gdb_assert() in 
breakpoint.c line 7451.
This is in function breakpoint_re_set_one().
Let me tell you what I am doing to get it (reproduceably). I am not a 
guru to gdb's internals so
please forgive me if I conclude something wrong.

I am having a mixed C and Objective C application. I am running on 
windows using GNUstep
for my ObjC Foundation classes. GNUstep-base is a shared library loaded 
lazy.
Due to the nature of this bug I assume that this will also appear on 
other platforms like linux
(according to my analysis). So it is not windows specific.

I start gdb and set a breakpoint to main() using "b main". Then I run my 
app using "r".
A few seconds later I get the assert in breakpoint.c:7451 
gdb_assert(sals.nelts==1).
When I debug into it sals.nelts == 2. The assert happens when the 
gnustep-base shared
library was loaded.

What has happenend: In breakpoint.c line 7417 you find:
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, (char ***) 
NULL,not_found_ptr);
s points to "main" at that moment as found in the breakpoint structure 
supplied to breakpoint_re_set_one().

sals (returned from decode_line_1) contains 2 entries.
Sals entry 0 points to the ObjectiveC METHOD main of the foundation base 
class NSThread
(written in ObjC notation -[NSThread main]). This is a real ObjC 
baseclass not something
from my own code. It has also nothing to do with an application's 
entrypoint. It also perfectly
legal in ObjectiveC to name methods like C functions. They do not collide.
Sals entry 1 points to the function "main()" of my application. This is 
the entry which I think is
the correct one to use here.

Obviously decode_line_1 returns every symbol matching a certain string 
independant of
its language. As far as I understand gdb at the moment this appears to 
be ok.

So what is the correct behaviour here to fix this problem? I assume that 
there might be more
areas of symbol duplicates that can occur not only main() vs -[NSThread 
main].

Maybe the assert should be replaced by a loop over the sals entries 
matching the infos from the
breakpoint structure passed to breakpoint_re_set_one() and the 
individual symtab entry of one
sals entry by filename(?) matching?

Thanks in advance for your help,

Roland



             reply	other threads:[~2009-03-10 14:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-10 14:02 Roland Schwingel [this message]
2009-03-10 15:39 ` Paul Pluzhnikov
2009-03-17 10:24 ` Kai Tietz
2009-03-21 16:26   ` Kai Tietz
2009-04-30 21:37     ` Joel Brobecker
2009-03-10 16:45 Roland Schwingel
2009-03-17 11:44 Roland Schwingel

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=49B67300.1020503@onevision.de \
    --to=roland.schwingel@onevision.de \
    --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