From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4954 invoked by alias); 7 Feb 2011 14:26:26 -0000 Received: (qmail 4865 invoked by uid 22791); 7 Feb 2011 14:26:24 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Feb 2011 14:26:18 +0000 Received: (qmail 23889 invoked from network); 7 Feb 2011 14:26:15 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Feb 2011 14:26:15 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [unavailable values part 1, 00/17] introduction Date: Mon, 07 Feb 2011 14:26:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-25-generic; KDE/4.5.1; x86_64; ; ) MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201102071426.12328.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00131.txt.bz2 In the context of tracepoints, I've been working on adding support for partial/incomplete objects. That is, say, when printing an array where only a few elements have been collected, print what you can, and print something like "" (like ) for what has not been collected. E.g., with: struct foo { int a, b; int array[10000]; void *ptr; }; struct foo2 { int d, ef; struct foo foo; }; struct foo2 foo2; and a tracepoint that just collects "foo2.foo.array[0]", when printing foo2 while inspecting the corresponding collected traceframe, currently we get: (gdb) p foo2 Cannot access memory at address 0x601080 This is GDB trying to read [&foo2, &foo2+sizeof foo2) for an lval_memory value representing "foo2" and the read failing because required memory is not "available" (it was not collected). vs afterwards, after all the necessary changes, we'll get something like: (gdb) p foo2 $1 = {d = , ef = , foo = {a = , b = , array = {12345678, }, ptr = }} That is, we will still print what is available. This requires marking chunks of a value's contents buffer as "unavailable" at value read time, and, at value print time, check whether the value contents chunk being printed is "available". The "unavailable"-ness of the contents needs to be part of the struct value itself, given that when printing a value from the value history, you still want to know what is or isn't available, without consulting the target (which may not exist anymore). The "unavailable"-ness of the contents is independent of the backend lval_type (and implementation) behind a given struct value, as it describes a "run-time"-ish property of the value. This series implements the base unavailable-value support, and glues it with memory-based objects. Then, it fixes the printing machinery to know how to print unavailable values in assorted situations, and adds base tests. Unavailable/uncollected function locals and arguments won't be printing gracefully yet after this series, as the glue between unavailable register / frame / values will only come in a follow up series. After all that, frame unwinding will also be taught to terminate gracefully when not enough (stack/registers) data has been collected, instead of printing errors, as currently. I'd appreciate comments and extra eyeballs on all of this. Pending objections, I'd like to commit this after a reasonable wait. I've regtested the series as a whole against current mainline, and I saw no regressions. -- Pedro Alves