From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17867 invoked by alias); 12 Mar 2008 19:03:34 -0000 Received: (qmail 17848 invoked by uid 22791); 12 Mar 2008 19:03:31 -0000 X-Spam-Check-By: sourceware.org Received: from bluesmobile.specifix.com (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 12 Mar 2008 19:03:08 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id 56B423BE59; Wed, 12 Mar 2008 12:03:06 -0700 (PDT) Subject: Re: Can back trace be stopped from always prints "char*" strings ? From: Michael Snyder To: Chris Johns Cc: gdb@sourceware.org In-Reply-To: <47D79ECF.7000900@rtems.org> References: <47D79ECF.7000900@rtems.org> Content-Type: text/plain Date: Wed, 12 Mar 2008 20:15:00 -0000 Message-Id: <1205348586.19253.844.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-7.fc7) Content-Transfer-Encoding: 7bit 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-03/txt/msg00133.txt.bz2 On Wed, 2008-03-12 at 20:13 +1100, Chris Johns wrote: > Hello, > > I have a union being passed to a function. The union is: > > typedef union { > /** This is a pointer to a string name. */ > const char *name_p; > /** This is the actual 32-bit "raw" integer name. */ > uint32_t name_u32; > } Objects_Name; > > The problem is the bt command ties to read the string pointed to by name_p > how-ever this can be any value if the name_u32 field has been set. This has > side effects on the embedded target I am using like killing the session. > > Is there a way to stop the bt accessing the char* data and just printing the > pointer value ? Close... The closest we have is "set print elements", which will set a limit on how many elements of an array (including a string) are printed by default. Unfortunately, zero has been used to mean "no limit", otherwise it would do exactly what you want. If you "set print elements 1", it will only print the first byte of the string -- maybe that will help? Gosh guys, it would mean changing documented behavior, but maybe we ought to consider making zero mean zero, and maybe making -1 mean "unlimited"...