From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6741 invoked by alias); 2 Apr 2008 16:32:17 -0000 Received: (qmail 6731 invoked by uid 22791); 2 Apr 2008 16:32:16 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.168) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 02 Apr 2008 16:31:59 +0000 Received: by ug-out-1314.google.com with SMTP id h2so774450ugf.12 for ; Wed, 02 Apr 2008 09:31:56 -0700 (PDT) Received: by 10.66.237.9 with SMTP id k9mr684439ugh.13.1207153916680; Wed, 02 Apr 2008 09:31:56 -0700 (PDT) Received: by 10.67.122.5 with HTTP; Wed, 2 Apr 2008 09:31:56 -0700 (PDT) Message-ID: Date: Wed, 02 Apr 2008 16:32:00 -0000 From: JBWeeN To: gdb@sourceware.org Subject: Problem Assining Values to Arrays in GDB 4.17 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: 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: 2008-04/txt/msg00010.txt.bz2 First of all, thanks for read my message. I am having the following problem: I am using GDB 4.17, I would like to upgrade it to a modern version, but I am obliged. In modern GDB releases I can assign directly values to an array using the following sintax: (gdb) set var myArray = {1.0, 2.0, 3.0, 4.0, 5.0,6.0} But in this release (GDB 4.17) If I use the same command, I get the following error: (gdb) set var myArray = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0} Invalid Cast Looking for information about the problem I found that I could solve the problem doing a direct cast: (gdb) set var myArray = {double *} {1.0, 2.0, 3.0, 4.0, 5.0, 6.0} I do not why, but this solution only works sometimes. Other times, it appears the following error: Cannot access memory at address 0x545f98. It seems that GDB tries to modify myArray pointing to a new memory address, but it is very strange that this new address not exists. I know that I have another solution (gdb) set myArray[0] = ... (gdb) set myArray[1] = ... (gdb) set myArray[2] = ... (gdb) set myArray[3] = ... But I have a lot of GDB scripts with a lot of arrays assignments that use this syntax and I have to migrate them to GDB 4.17. Is there any other way to assign array values directly? Is there my only option to assing one by one? (I hope it is not) Thanks for all, Best Regards