From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15428 invoked by alias); 22 Sep 2010 09:09:30 -0000 Received: (qmail 15417 invoked by uid 22791); 22 Sep 2010 09:09:28 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Sep 2010 09:09:24 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8M99MEO004642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 22 Sep 2010 05:09:23 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8M99Krj019139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 22 Sep 2010 05:09:22 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o8M99Kh7025136 for ; Wed, 22 Sep 2010 11:09:20 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o8M99JVu025135 for gdb-patches@sourceware.org; Wed, 22 Sep 2010 11:09:19 +0200 Date: Wed, 22 Sep 2010 16:20:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] python: load *-gdb.py for shlibs during attach Message-ID: <20100922090919.GA21901@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) 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: 2010-09/txt/msg00370.txt.bz2 Hi, currently if you attach to or load a core file for executable, its -gdb.py script is loaded. But none -gdb.py for the shared libraries. Spawned or with the fix (libstdc++-gdb.py): #1 0x00000000004007b5 in f (s="a") at 1.C:4 ^ is std::string Attached/core without the fix: #1 0x00000000004007b5 in f (s=...) at 1.C:4 No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. Mostly obvious, I will check it in later. Thanks, Jan gdb/ 2010-09-22 Jan Kratochvil * main.c: Include objfiles.h. (captured_main): New variable objfile. Call load_auto_scripts_for_objfile for ALL_OBJFILES. --- ./gdb/main.c 2010-09-22 10:51:32.000000000 +0200 +++ ./gdb/main.c 2010-09-22 10:50:44.000000000 +0200 @@ -43,6 +43,7 @@ #include "source.h" #include "cli/cli-cmds.h" #include "python/python.h" +#include "objfiles.h" /* The selected interpreter. This will be used as a set command variable, so it should always be malloc'ed - since @@ -323,6 +324,7 @@ captured_main (void *data) int i; int save_auto_load; + struct objfile *objfile; struct cleanup *pre_stat_chain = make_command_stats_cleanup (0); @@ -957,8 +959,8 @@ Can't attach to process and specify a co We wait until now because it is common to add to the source search path in local_gdbinit. */ gdbpy_global_auto_load = save_auto_load; - if (symfile_objfile != NULL) - load_auto_scripts_for_objfile (symfile_objfile); + ALL_OBJFILES (objfile) + load_auto_scripts_for_objfile (objfile); for (i = 0; i < ncmd; i++) {