From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17428 invoked by alias); 12 Jun 2014 12:07:29 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 17389 invoked by uid 89); 12 Jun 2014 12:07:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Jun 2014 12:07:28 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5CC7Pc3019831 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jun 2014 08:07:26 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5CC7ObA009630; Thu, 12 Jun 2014 08:07:25 -0400 Message-ID: <539997FB.9060709@redhat.com> Date: Thu, 12 Jun 2014 12:07:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] "$ gdb PROGRAM" vs "(gdb) file PROGRAM" difference; warn on failure to remove breakpoint. References: <1402323778-27849-1-git-send-email-palves@redhat.com> <539922D1.9030904@codesourcery.com> In-Reply-To: <539922D1.9030904@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-06/txt/msg00499.txt.bz2 On 06/12/2014 04:47 AM, Yao Qi wrote: > On 06/09/2014 10:22 PM, Pedro Alves wrote: >> And, likewise, "file" with no arguments only started turning >> breakpoints set in the main executable to "" with the >> remote-symbol-file patch (63644780). The old behavior is now > ^^^^^^ remove > > I don't see breakpoint set in the main executable becomes "" > (with and without this patch applied), if the following steps are what > you meant. > > (gdb) b main > Breakpoint 1 at 0x80484c1: file > ../../../../git/gdb/testsuite/gdb.base/wchar.c, line 29. > > (gdb) file > No executable file now. > Discard symbol table from > `/home/yao/Source/gnu/gdb/build-git/x86/gdb/testsuite/gdb.base/wchar'? > (y or n) y > Error in re-setting breakpoint 1: No symbol table is loaded. Use the > "file" command. > No symbol file now. > (gdb) info breakpoints That's with "gdb PROGRAM". If you do "gdb -ex "file PROGRAM" instead, you get: $ ./gdb -q -ex "file ~/gdb/tests/main" Reading symbols from ~/gdb/tests/main...done. (gdb) b main Breakpoint 1 at 0x4004cf: file main.c, line 5. (gdb) file No executable file now. Discard symbol table from `/home/pedro/gdb/tests/main'? (y or n) y No symbol file now. (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y main (gdb) Note how currently break-unload-file.exp is expecting the , and is passing today. That's only because the testsuite always uses "file PROGRAM". The patch does: - gdb_test "info break" "y.*PENDING.*foo" \ - "breakpoint is pending" + # This test used to behave differently depending on whether + # the program was first loaded through "file PROGRAM" or "gdb + # PROGRAM". + set ws "\[ \t\]" + gdb_test "info break" "breakpoint${ws}+keep${ws}+n${ws}+$hex${ws}*" \ + "breakpoint is disabled" ... and also makes break-unload-file.exp load the PROGRAM into GDB using both forms (runs the whole test file once for each form). Without the code patch, that "info break" would show PENDING in one case, but not on the other. > shared library loaded by program OBJF_SHARED > add-symbol-file foo OBJF_SHARED | OBJF_USERLOADED > symbol-file or file foo OBJF_USERLOADED > ./gdb foo Neither Correct. >> shlib_disabled so they end up uninserted on the next global >> location list update. Shared libraries not loaded by the user >> aren't handled here -- they're already handled in >> disable_breakpoints_in_unloaded_shlib, called by solib.c's >> solib_unloaded observer. We skip objfiles that are not >> - OBJF_USERLOADED (nor OBJF_SHARED) as those aren't considered >> - dynamic objects (e.g. the main objfile). */ >> - if ((objfile->flags & OBJF_USERLOADED) == 0) >> + OBJF_SHARED as those aren't considered dynamic objects (e.g. the >> + main objfile). */ >> + if ((objfile->flags & OBJF_SHARED) == 0 >> + || (objfile->flags & OBJF_USERLOADED) == 0) >> return; > > ... these are clear too, but shouldn't we only check > "(objfile->flags & OBJF_SHARED) == 0" here? which means objfile is a > shared library loaded by program or is added by add-symbol-file can > be processed afterwards. Shared libraries loaded by program (or more correctly, automatically managed by the solib framework) are handled by disable_breakpoints_in_unloaded_shlib, as the comment above explains: "Shared libraries not loaded by the user aren't handled here -- they're already handled in disable_breakpoints_in_unloaded_shlib, called by solib.c's solib_unloaded observer." -- Pedro Alves