From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27285 invoked by alias); 8 Mar 2005 06:45:50 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27166 invoked from network); 8 Mar 2005 06:45:38 -0000 Received: from unknown (HELO priv-edtnes56.telusplanet.net) (199.185.220.220) by sourceware.org with SMTP; 8 Mar 2005 06:45:38 -0000 Received: from takamaka.act-europe.fr ([142.179.108.108]) by priv-edtnes56.telusplanet.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050308064533.MWQT5607.priv-edtnes56.telusplanet.net@takamaka.act-europe.fr> for ; Mon, 7 Mar 2005 23:45:33 -0700 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 4CF4B47DC0; Mon, 7 Mar 2005 22:45:29 -0800 (PST) Date: Tue, 08 Mar 2005 06:45:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFA] re-read symbols before "start"-ing... Message-ID: <20050308064529.GB18053@adacore.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2005-03/txt/msg00110.txt.bz2 --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1994 Humpf, I thought I checked that this scenario was working: - build first (Ada program, main program name is "first") - build second (Ada program, main program name is "second") - mv first common - gdb (gdb) file common (gdb) start --> lands in "first" - mv common first - mv second common - (gdb) start --> lands in "second" I thought I checked that this was working because I added an executable-changed notification just for that. In reality, it doesn't work. When I tried a new testcase that I am currently writing, here is what I actually get: (gdb) start^M Breakpoint 2 at 0x804980b: file /home/no-backup/brobecke/testing/gdb-public/gdb/testsuite/gdb.ada/exec_changed/first.adb, line 4.^M `/home/no-backup/brobecke/testing/gdb-public/gdb/testsuite/gdb.ada/exec_changed/common' has changed; re-reading symbols.^M Error in re-setting breakpoint 2:^M Function "_ada_first" not defined.^M Error in re-setting breakpoint 2:^M Function "_ada_first" not defined.^M Error in re-setting breakpoint 2:^M Function "_ada_first" not defined.^M Error in re-setting breakpoint 2:^M Function "_ada_first" not defined.^M ^M Program exited normally.^M (gdb) FAIL: gdb.ada/exec_changed.exp: start second What happens here is that we insert the breakpoint *before* the notification is received. So we end up using the cached value for the main procedure name, which is out of date. The answer is to make sure the symbols are re-read if the executable has changed. Bad point for me, sorry... Fortunatly, only Ada is affected for now. Attached is a patch. 2005-03-07 Joel Brobecker * infcmd.c (start_command): Make sure the symbols are up to date before setting the temporary breakpoint. Tested on x86-linux. This fixes the FAIL above. Otherwise, the results are identical. OK to commit? Thanks, -- Joel --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="start-reread.diff" Content-length: 853 Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.134 diff -p -r1.134 infcmd.c *** infcmd.c 21 Feb 2005 03:25:56 -0000 1.134 --- infcmd.c 8 Mar 2005 06:43:05 -0000 *************** start_command (char *args, int from_tty) *** 512,517 **** --- 512,523 ---- the user changes its mind. */ kill_if_already_running (from_tty); + /* Make sure that the symbols are up to date. Otherwise, we might + end up inserting the temporary breakpoint before we receive the + executable-changed notification, potentially causing us to use + the wrong function name as the main procedure. */ + reread_symbols (); + /* Insert the temporary breakpoint, and run... */ tbreak_command (main_name (), 0); run_command (args, from_tty); --jRHKVT23PllUwdXP--