From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110939 invoked by alias); 13 Jul 2017 15:32:15 -0000 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 Received: (qmail 110913 invoked by uid 89); 13 Jul 2017 15:32:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=1753 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 15:32:11 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7A11804F0 for ; Thu, 13 Jul 2017 15:32:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B7A11804F0 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B7A11804F0 Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23C8767CFC for ; Thu, 13 Jul 2017 15:32:09 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 00/13] No-debug-info debugging improvements Date: Thu, 13 Jul 2017 15:32:00 -0000 Message-Id: <1499959929-29497-1-git-send-email-palves@redhat.com> X-SW-Source: 2017-07/txt/msg00137.txt.bz2 New in v2: - The new simpler cast-return-type syntax now assumes the called function is prototyped instead of unprototyped: https://sourceware.org/ml/gdb-patches/2017-07/msg00128.html - Documentation patch adjusted accordingly. - The fix for calling prototyped functions via function pointers is now patch #1, because the v2 of patch #2 includes new tests that depend on the fix. This series stops GDB from assuming that no-debug-info functions return int, and that no-debug-info variables have type int. E.g. instead of this, if you have no debug info for glibc: (gdb) p getenv("PATH") $1 = -6185 You'll get: (gdb) p getenv ("PATH") 'getenv' has unknown return type; cast the call to its declared return type (gdb) p (char *) getenv ("PATH") # now Just Works $1 = 0x7fffffffe7d7 "/usr/local/bin:/"... (gdb) p ((char *(*) (const char *)) getenv) ("PATH") # continues working $1 = 0x7fffffffe7d7 "/usr/local/bin:/"... And similarly for variables. While implementing and writing tests for the above, I ran into a few other problems (as usual...), and fixed them too. Most of the problems were related to printing static local variables, with the documented "p klass::method()::static_var" syntax. One other problem I ran into today while writing the documentation patch... I wanted to document when to call a no-debug-info function by casting it to the right function pointer type, and calling that pointer, and noticed that that doesn't actually work correctly... GDB always leaves the target function type of the function pointer type as an unprototyped function, meaning that it applies argument coercion incorrectly. W00t! See many more details and rationale on the description of each patch. Documentation is in the last patch. Tested on x86-64 GNU/Linux, native and gdbserver, both with and without glibc debug info. Adds over 3700 new passes: -# of expected passes 39661 +# of expected passes 43405 I see this series as follow up to the recent "whatis" fixes for Zack's errno pretty printer: https://sourceware.org/ml/gdb-patches/2017-06/msg00827.html https://sourceware.org/ml/gdb-patches/2017-07/msg00018.html so I put this series on top of those patches in the same branch: users/palves/whatis Pedro Alves (13): Fix calling prototyped functions via function pointers Stop assuming no-debug-info functions return int Introduce OP_VAR_MSYM_VALUE Make ptype/whatis print function name of functions with no debug info too evaluate_subexp_standard: Eliminate one goto evaluate_subexp_standard: Remove useless assignments evaluate_subexp_standard: Factor out OP_VAR_VALUE handling. Stop assuming no-debug-info variables have type int Eliminate UNOP_MEMVAL_TLS Handle "p S::method()::static_var" in the C++ parser Handle "p 'S::method()::static_var'" (quoted) in symbol lookup Make "p S::method() const::static_var" work too Document "no debug info debugging" improvements gdb/doc/gdb.texinfo | 114 +++++- gdb/NEWS | 26 ++ gdb/ada-lang.c | 11 +- gdb/ada-typeprint.c | 7 +- gdb/ax-gdb.c | 72 +++- gdb/c-exp.y | 51 ++- gdb/c-typeprint.c | 10 +- gdb/compile/compile-c-symbols.c | 4 +- gdb/compile/compile-c-types.c | 35 +- gdb/compile/compile-object-run.c | 3 +- gdb/cp-namespace.c | 50 +-- gdb/dwarf2read.c | 46 ++- gdb/elfread.c | 2 +- gdb/eval.c | 439 ++++++++++++++------- gdb/expprint.c | 92 +++-- gdb/expression.h | 1 + gdb/f-typeprint.c | 7 +- gdb/gcore.c | 2 +- gdb/gdbtypes.c | 27 +- gdb/gdbtypes.h | 15 +- gdb/guile/scm-value.c | 2 +- gdb/infcall.c | 49 ++- gdb/infcall.h | 19 +- gdb/linux-fork.c | 6 +- gdb/linux-tdep.c | 4 +- gdb/m2-typeprint.c | 11 +- gdb/minsyms.h | 9 + gdb/objc-lang.c | 14 +- gdb/p-typeprint.c | 57 +-- gdb/parse.c | 130 +++--- gdb/parser-defs.h | 2 + gdb/python/py-value.c | 3 +- gdb/rust-lang.c | 2 +- gdb/std-operator.def | 43 +- gdb/testsuite/gdb.asm/asm-source.exp | 8 +- .../gdb.base/break-main-file-remove-fail.exp | 2 +- gdb/testsuite/gdb.base/break-probes.exp | 2 +- gdb/testsuite/gdb.base/callfuncs.exp | 26 +- gdb/testsuite/gdb.base/checkpoint.exp | 44 +-- gdb/testsuite/gdb.base/dprintf-detach.exp | 2 +- gdb/testsuite/gdb.base/infcall-exec.exp | 2 +- gdb/testsuite/gdb.base/info-os.exp | 8 +- gdb/testsuite/gdb.base/nodebug.c | 48 +++ gdb/testsuite/gdb.base/nodebug.exp | 194 +++++++-- gdb/testsuite/gdb.base/solib-display.exp | 16 +- gdb/testsuite/gdb.compile/compile-ifunc.exp | 5 +- gdb/testsuite/gdb.compile/compile.exp | 10 +- gdb/testsuite/gdb.cp/local-static.c | 170 ++++++++ gdb/testsuite/gdb.cp/local-static.cc | 1 + gdb/testsuite/gdb.cp/local-static.exp | 241 +++++++++++ gdb/testsuite/gdb.cp/m-static.exp | 5 - gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.exp | 2 +- gdb/testsuite/gdb.threads/siginfo-threads.exp | 7 +- gdb/testsuite/gdb.threads/tls-nodebug.exp | 5 +- gdb/testsuite/gdb.trace/entry-values.exp | 6 +- gdb/typeprint.c | 18 +- gdb/typeprint.h | 9 + gdb/valarith.c | 4 +- gdb/valops.c | 7 +- 59 files changed, 1753 insertions(+), 454 deletions(-) create mode 100644 gdb/testsuite/gdb.cp/local-static.c create mode 100644 gdb/testsuite/gdb.cp/local-static.cc create mode 100644 gdb/testsuite/gdb.cp/local-static.exp -- 2.5.5