From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6990 invoked by alias); 10 Mar 2009 14:02:55 -0000 Received: (qmail 6765 invoked by uid 22791); 10 Mar 2009 14:02:54 -0000 X-SWARE-Spam-Status: No, hits=1.8 required=5.0 tests=AWL,BAYES_00,BOTNET,J_CHICKENPOX_45,RDNS_NONE X-Spam-Check-By: sourceware.org Received: from Unknown (HELO andromeda.onevision.de) (212.77.172.62) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 10 Mar 2009 14:02:44 +0000 Received: from [192.168.5.120] (kgi05104.onevision.de [192.168.5.120]) by andromeda.onevision.de (8.14.2/8.12.9/ROSCH/DDB) with ESMTP id n2AE2eVT001994 for ; Tue, 10 Mar 2009 15:02:40 +0100 Message-ID: <49B67300.1020503@onevision.de> Date: Tue, 10 Mar 2009 14:02:00 -0000 From: Roland Schwingel User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: gdb Subject: gdb_assert when resetting breakpoints Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-03/txt/msg00076.txt.bz2 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