From patchwork Tue Apr 18 04:20:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Dodd X-Patchwork-Id: 20065 Received: (qmail 59871 invoked by alias); 18 Apr 2017 04:20:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 42258 invoked by uid 89); 18 Apr 2017 04:20:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-yw0-f181.google.com Received: from mail-yw0-f181.google.com (HELO mail-yw0-f181.google.com) (209.85.161.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Apr 2017 04:20:09 +0000 Received: by mail-yw0-f181.google.com with SMTP id j9so64278850ywj.3 for ; Mon, 17 Apr 2017 21:20:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=KXS+DL+TbsEdi7QR3GpvRsSaKuPVmOxgeD+Q14HDvpA=; b=YIjpAw/1Pw6AyInefMeXWmDDSCN5cuuZTquQV+FYKRBNRoXnCGnEZMRJvH3FGi90Vb f1e5i+nUJ03P2UYaoPVK0P+p8tPvwPYtxPfNOTCayLVrqrOhHQlDPIcrHoV+oP2Fal6x dnjrVZ1ieN8XwG9SpcOnoSGEdPcjZsw4YpQMk4SsHx87JbLU906hKED03KYevNI17h6j RIRWirojrmD44h8XoTtFrHWqJTw7t8Y2KXM0a/o1II0gEvo+rehBkiDAieWm5v62D6fY GoCZixNir/xDtNSZNtD5NJwO99ED/xpBxY/u4iK87iosfGgCBOiexWCqG82hUWHWsLig Ojng== X-Gm-Message-State: AN3rC/7SolRcYKBFYPKEBHhCgyE/XPnrWnKyiQ32j1H2oxp0pMJfH+Bp jA4nUImmqBnPVZIRGAVHJdvA7M5VjbVS X-Received: by 10.13.222.66 with SMTP id h63mr5264732ywe.173.1492489209411; Mon, 17 Apr 2017 21:20:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.172.131 with HTTP; Mon, 17 Apr 2017 21:20:09 -0700 (PDT) From: Chris Dodd Date: Mon, 17 Apr 2017 21:20:09 -0700 Message-ID: Subject: Spurious warnings about construction vtables. To: gdb-patches@sourceware.org If you put a breakpoint in a C++ constructor, you often get a spurious warning about the "construction vtable for CLASS". If you have a condition on the breakpoint (becuase you only want a specific call of the ctor and want to skip many up that point), you get a huge spew of these warnings. Here's a small patch that avoids the warning when it not actually anything wrong happening: index 0090990..2bd8d9a 100644 TYPE_SAFE_NAME (values_type)); @@ -336,7 +353,6 @@ gnuv3_rtti_type (struct value *value, warning (_(" found `%s' instead"), vtable_symbol_name); return NULL; } - class_name = vtable_symbol_name + 11; /* Strip off @plt and version suffixes. */ atsign = strchr (class_name, '@'); Chris Dodd cdodd@acm.org --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -327,8 +327,25 @@ gnuv3_rtti_type (struct value *value, type_info object itself to get the class name. But this way should work just as well, and doesn't read target memory. */ vtable_symbol_name = MSYMBOL_DEMANGLED_NAME (vtable_symbol); - if (vtable_symbol_name == NULL - || !startswith (vtable_symbol_name, "vtable for ")) + if (vtable_symbol_name && startswith (vtable_symbol_name, "vtable for ")) + class_name = vtable_symbol_name + 11; + else if (vtable_symbol_name && startswith (vtable_symbol_name, "construction vtable for ")) + { + const char *tail; + + class_name = vtable_symbol_name + 24; + tail = strstr(class_name, "-in-"); + if (tail != NULL) + { + char *copy; + + copy = (char *) alloca (tail - class_name + 1); + memcpy (copy, class_name, tail - class_name); + copy[tail - class_name] = '\0'; + class_name = copy; + } + } + else { warning (_("can't find linker symbol for virtual table for `%s' value"),