From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16205 invoked by alias); 10 Oct 2005 20:46:15 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 16176 invoked by uid 22791); 10 Oct 2005 20:46:13 -0000 Received: from cpc2-oxfd8-3-0-cust199.oxfd.cable.ntl.com (HELO cpc2-oxfd8-3-0-cust199.oxfd.cable.ntl.com) (82.15.10.199) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 10 Oct 2005 20:46:13 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by cpc2-oxfd8-3-0-cust199.oxfd.cable.ntl.com (8.13.4/8.13.4) with ESMTP id j9AL4A3P007684 for ; Mon, 10 Oct 2005 22:04:11 +0100 Subject: Laziness From: David Lecomber To: gdb Content-Type: text/plain Date: Mon, 10 Oct 2005 20:46:00 -0000 Message-Id: <1128978249.13892.22.camel@cpc2-oxfd8-3-0-cust199.oxfd.cable.ntl.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-10/txt/msg00062.txt.bz2 Hi Folks, Take a simple code with a big array... #include int main() { double x[1000][1000]; printf("hello mum"); } and ask gdb to "set print elements 1", then break at the printf, and say "output x". It takes a while.. (not as much as it used to on Linux thanks to the /proc memory reading recently committed) but on other platforms it literally sucks. The busy bit of the stack is here: #6 0x0807f37b in target_read_memory (memaddr=3207201336, myaddr=0xb5e49048 "", len=8000000) at target.c:1000 #7 0x08084a5a in read_memory (memaddr=3207201336, myaddr=0xb5e49048 "", len=8000000) at corefile.c:239 #8 0x080e2509 in value_fetch_lazy (val=0xb5e49008) at valops.c:515 #9 0x080dc4fb in value_contents_all (value=0xb5e49008) at value.c:331 #10 0x08167551 in c_value_print (val=0xb5e49008, stream=0x91ea940, format=0, pretty=Val_pretty_default) at c-valprint.c:596 #11 0x080eb0f4 in print_formatted (val=0xb5e49008, format=0, size=0, stream=0x91ea940) at .././gdb/printcmd.c:335 #12 0x080eb776 in output_command (exp=0x91ea9a7 "x", from_tty=1) at .././gdb/printcmd.c:985 Should we really really be reading all that memory, just to print the first element? I mean, not only is that slow, but it imposes a memory overhead in the GDB too! Should we be using a better method? Cheers David -- David Lecomber