From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 867 invoked by alias); 1 Jun 2007 01:32:12 -0000 Received: (qmail 857 invoked by uid 22791); 1 Jun 2007 01:32:11 -0000 X-Spam-Check-By: sourceware.org Received: from py-out-1112.google.com (HELO py-out-1112.google.com) (64.233.166.181) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 01 Jun 2007 01:32:10 +0000 Received: by py-out-1112.google.com with SMTP id a25so1009096pyi for ; Thu, 31 May 2007 18:32:08 -0700 (PDT) Received: by 10.64.208.20 with SMTP id f20mr2179964qbg.1180661528203; Thu, 31 May 2007 18:32:08 -0700 (PDT) Received: by 10.65.237.20 with HTTP; Thu, 31 May 2007 18:32:07 -0700 (PDT) Message-ID: Date: Fri, 01 Jun 2007 01:32:00 -0000 From: "Ray Bejjani" Subject: Re: Turning off printing of char pointer contents Cc: gdb@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: 2007-06/txt/msg00000.txt.bz2 Thanks! That should do it. I can set regions, but I cant set (or even show) the inaccessible-by-default setting . It's in the manual, and I've tried it with 6.5 and 6.6 (in case it was new) but it simply doesn't know what it is. I don't know if it matters, but I'm cross-debugging a coldfire, so maybe it isn't supported (of course, I cant seem to set it in my x86 one either). I get: (gdb) set mem inaccessible-by-default on No symbol "mem" in current context. Thanks again, sorry for being quite useless. On 5/31/07, Jim Blandy wrote: > > "Ray Bejjani" writes: > > I'm trying to turn off printing the contents of char pointers. I'm use > > GDB to debug an embedded app remotely. In some instances the pointers > > are left uninitialised and can point to sections of memory that cause > > system crashes when accessed (or they cause external hardware to > > change state when read). I am using DDD on top of GDB but I can > > reproduce the issue with GDB as well. GDB seems to treat C strings in > > a special manner, attempting to print the contents until it sees an > > null terminator or hit the limit set by the "print elements" setting. > > My system crashes when this happens. > > Unfortunately, doing a set print elements 0 is interpreted as no > > limit. Are there any other settings I can use to suppress this > > feature? In particular, I would like it to treat char (or unsigned > > char) pointers like it does other pointers where it doesn't attempt to > > dereference them. I would still like to be able to display/print the > > contents of strings when needed but only on demand. Failing that, > > where in the code should I look to try and force this to not happen? > > Have you looked at "Memory region attributes" in the GDB manual? You > can define memory regions, and then use 'set mem > inaccessible-by-default' to tell GDB not to touch memory regions you > haven't defined. >