From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13851 invoked by alias); 26 Apr 2008 13:24:07 -0000 Received: (qmail 13841 invoked by uid 22791); 26 Apr 2008 13:24:06 -0000 X-Spam-Check-By: sourceware.org Received: from host0.dyn.jankratochvil.net (HELO host0.dyn.jankratochvil.net) (89.250.240.59) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 26 Apr 2008 13:23:48 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.2/8.14.1) with ESMTP id m3QDMQJh016233; Sat, 26 Apr 2008 15:22:26 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.2/8.14.2/Submit) id m3QDMPBk016232; Sat, 26 Apr 2008 15:22:25 +0200 Date: Sat, 26 Apr 2008 13:42:00 -0000 From: Jan Kratochvil To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Entry point update with "run" command Message-ID: <20080426132225.GA16017@host0.dyn.jankratochvil.net> References: <1209052694.18229.6.camel@gargoyle.br.ibm.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="fUYQa+Pmc3FrFX/N" Content-Disposition: inline In-Reply-To: <1209052694.18229.6.camel@gargoyle.br.ibm.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-IsSubscribed: yes 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 X-SW-Source: 2008-04/txt/msg00590.txt.bz2 --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 429 On Thu, 24 Apr 2008 17:58:14 +0200, Luis Machado wrote: > Hi folks, > > It seems GDB doesn't really update the entry point of an object file if > we "reload" the modified binary through the "run" command. There is a problem whole EXEC_BFD becomes stale - using the more general attached patch. Still I agree it is a hack as besides whole reload-on-change is a hack also GDB still misses some real OO framework. Regards, Jan --fUYQa+Pmc3FrFX/N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="gdb-6.7-reread-exec_bfd.patch" Content-length: 1799 2007-10-29 Jan Kratochvil * symfile.c (reread_symbols): Reread also EXEC_BFD if changed. 2008-04-11 Jan Kratochvil * symfile.c (reread_symbols): Reload whole EXEC_BFD by the EXEC module as its in-place patching did cause regressions. Testcase: Regressed by the gdb-6.7 version of `gdb-6.3-pie-20050110.patch': Running ../../../gdb/testsuite/gdb.base/reread.exp ... PASS: gdb.base/reread.exp: breakpoint foo in first file (PRMS 13484) PASS: gdb.base/reread.exp: run to foo() (PRMS 13484) -PASS: gdb.base/reread.exp: run to foo() second time +FAIL: gdb.base/reread.exp: run to foo() second time PASS: gdb.base/reread.exp: second pass: breakpoint foo in first file -PASS: gdb.base/reread.exp: second pass: run to foo() -PASS: gdb.base/reread.exp: second pass: continue to completion -PASS: gdb.base/reread.exp: second pass: run to foo() second time +FAIL: gdb.base/reread.exp: second pass: run to foo() +FAIL: gdb.base/reread.exp: second pass: continue to completion +FAIL: gdb.base/reread.exp: second pass: run to foo() second time --- gdb-6.7-orig/gdb/symfile.c 2007-10-29 01:04:35.000000000 +0100 +++ gdb-6.7-patched/gdb/symfile.c 2007-10-29 01:03:13.000000000 +0100 @@ -2810,6 +2810,12 @@ reread_symbols (void) /* We need to do this whenever any symbols go away. */ make_cleanup (clear_symtab_users_cleanup, 0 /*ignore*/); + if (exec_bfd != NULL && strcmp (bfd_get_filename (objfile->obfd), + bfd_get_filename (exec_bfd)) == 0) + { + exec_ops.to_open (bfd_get_filename (objfile->obfd), 0); + } + /* Clean up any state BFD has sitting around. We don't need to close the descriptor but BFD lacks a way of closing the BFD without closing the descriptor. */ --fUYQa+Pmc3FrFX/N--