From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13593 invoked by alias); 21 Apr 2007 12:43:57 -0000 Received: (qmail 13564 invoked from network); 21 Apr 2007 12:43:42 -0000 Received: from unknown (212.77.101.5) by sourceware.org with QMTP; 21 Apr 2007 12:43:42 -0000 Received: (wp-smtpd smtp.wp.pl 2572 invoked from network); 21 Apr 2007 14:43:26 +0200 Received: from host86-128-14-58.range86-128.btcentralplus.com (HELO BIGOS) (jagorak@[86.128.14.58]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 21 Apr 2007 14:43:26 +0200 Date: Sat, 21 Apr 2007 12:43:00 -0000 From: jagorak X-Mailer: Private Mailer 1.0 Reply-To: jagorak Message-ID: <1546343093.20070421134325@wp.pl> To: gdb@sourceware.org Subject: Setting a variable is very slow. MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 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: 2007-04/txt/msg00133.txt.bz2 Hi, I need to set a number of variables to certain values and then make a call to a procedure which takes those variables as inputs. Then I have to set the same set of variables to different values and make another call the procedure. And so on, and so on... . For example: Run1: (gdb) set ({Rec} 0xABCDEF00).a := false (gdb) set ({Rec} 0xABCDEF00).b := 55 (gdb) set x := 7.52 (gdb) set y := 725 (gdb) call myProcedure() // The body of this procedure uses the // vars which have been set above. (e.g. // those vars are member variables of a // class which this procedure belongs // to). Run2: (gdb) set ({Rec} 0xABCDEF00).a := true (gdb) set ({Rec} 0xABCDEF00).b := 56 (gdb) set x := -7.52 (gdb) set y := 125 (gdb) call myProcedure() ... Run1252: (gdb) set.... etc. I need to make hundreds of such assignments & calls. The problem is - setting a single variable is very slow (in most cases it takes much more time to set a single variable than to call a procedure, even if the procedure is not very simple). Any ideas why this is the case? *More importantly*: ===> Is there any way to make the assignments work faster? <=== E.g. by telling gdb to cache the address of a symbol (variable) so that everytime the symbol is being set gdb does not have to go through the symbol table to obtain the address (in case that would be the reason why assignments are very slow). Anyone has any ideas please? See also my notes below. Note1: I'm working with quite big executable (which contains thousands of other symbols / procedures). Note2: I already tried running the gdb session in the GDB/MI interface mode and setting the variables with appropriate MI command e.g. (gdb) -gdb-set x := -7.52 but it doesn't seem to make any effect on the speed of the execution of the assignment command. Many thanks, Jan