From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by sourceware.org (Postfix) with ESMTPS id D5A9F385781D for ; Fri, 6 May 2022 13:09:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5A9F385781D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id j15so10002482wrb.2 for ; Fri, 06 May 2022 06:09:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Gm0QBOehUrpE8EEaLoyF6bLGWnX3hBGA6T3+df/NTz4=; b=6FLvetJBdTfn56LS/2USBtmhfJC31kLgNdtSGTu7FuNj8HgcuELn6aixvKLsa1x2y6 atMI3GGqskkcpoFgy5QNaY/ZSPdAuT69i2VXbeOMsPA23XsLVJA3GIZNUctWAJwBBfSG wUEIuJrmWvJ5hZX54YsHx6TgzNhyGfTz7UPE53HPg840nuJjiX6bGhGzv00EhwaCH0AG HZh7OatgopISssL1aOA03jihLtJsttpY7yHdxU7O41XpCTcMc6LgQRLrbsSyw8CJ7CP1 bpDALwfMSN4Ftfm22DUSLP1QW30+iK+eTHaMJ6t2Cgfv4zoLevCRcCrIvg9I32KHxTPt aOnw== X-Gm-Message-State: AOAM5337XS/dPO5H61aJqTrb8//xjyLy2+BJd1NquJgAz5FaYKjnsQ9s JBivx+cniGP7Or8mALmJ/nWLkgdi//8= X-Google-Smtp-Source: ABdhPJyH/jsp/MCNWbCfowyDpDJFPqb/dpXt2nKaIL+3HZI30AQFicvcKV1ww6Y8rVkDZZgk+EJgOQ== X-Received: by 2002:a5d:59a5:0:b0:20c:561c:2a0b with SMTP id p5-20020a5d59a5000000b0020c561c2a0bmr2628508wrr.290.1651842589585; Fri, 06 May 2022 06:09:49 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id l13-20020a7bc34d000000b003942a244ebfsm4076187wmj.4.2022.05.06.06.09.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 May 2022 06:09:48 -0700 (PDT) Message-ID: <0cf140f0-6512-0d1b-af62-bc59f96261ea@palves.net> Date: Fri, 6 May 2022 14:09:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 1/3] Fix "b f(std::string)", always use DMGL_VERBOSE Content-Language: en-US To: Lancelot SIX Cc: gdb-patches@sourceware.org References: <20220505185020.3648774-1-pedro@palves.net> <20220505185020.3648774-2-pedro@palves.net> <20220506081029.x5ztruwtnhvir33n@octopus> From: Pedro Alves In-Reply-To: <20220506081029.x5ztruwtnhvir33n@octopus> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2022 13:09:54 -0000 On 2022-05-06 09:10, Lancelot SIX wrote: > Hi, > > I have minor comments inlined below. > >> [...] >> >> When the libiberty demangler encounters such a abbreviation, by >> default, it expands it to the user-friendly typedef "std::string", >> "std::iostream", etc.. If OTOH DMGL_VERBOSE is specified, the >> abbreviation is expanded to the underlying, non-typeded fullname > > s/non-typeded/non-typedefed/ ? Fixed. > >> [...] >> >> Now, if DMGL_VERBOSE is _not_ used, then the demangler demangles the >> mangled name of a function such as "void f(std::string)" thas was > > s/thas/that/ Fixed. > >> diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y >> index 6410363c87f..ceb4c968935 100644 >> --- a/gdb/cp-name-parser.y >> +++ b/gdb/cp-name-parser.y >> @@ -1959,8 +1959,7 @@ cp_comp_to_string (struct demangle_component *result, int estimated_len) > > The comment for this function is: > > /* Convert RESULT to a string. The return value is allocated > using xmalloc. ESTIMATED_LEN is used only as a guide to the > length of the result. This functions handles a few cases that > cplus_demangle_print does not, specifically the global destructor > and constructor labels. */ > > The last sentence (which references cplus_demangle_print) is not > accurate anymore. This was out of sync before your change, but while at > it, do you mind updating the comment? > >> { >> size_t err; >> >> - char *res = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, >> - result, estimated_len, &err); >> + char *res = gdb_cplus_demangle_print (result, estimated_len, &err); >> return gdb::unique_xmalloc_ptr (res); >> } > Hmm. I added back an "options" parameter to gdb_cplus_demangle_print, keeping it as a pure wrapper for cplus_demangle_print + DMGL_VERBOSE, otherwise cp_comp_to_string would just look like yet another wrapper around gdb_cplus_demangle_print, just for unique_xmalloc_ptr, which doesn't feel right. I then updated the description of cp_comp_to_string removing the stale bits and moved description to the header file. Here's the updated patch. >From 823135ae122a5de2d284c527395f7d06c3669f50 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Fri, 29 Apr 2022 23:21:18 +0100 Subject: [PATCH] Fix "b f(std::string)", always use DMGL_VERBOSE Currently, on any remotely modern GNU/Linux system, gdb.cp/no-dmgl-verbose.exp fails like so: break 'f(std::string)' Function "f(std::string)" not defined. (gdb) FAIL: gdb.cp/no-dmgl-verbose.exp: gdb_breakpoint: set breakpoint at 'f(std::string)' break 'f(std::basic_string, std::allocator >)' Function "f(std::basic_string, std::allocator >)" not defined. (gdb) PASS: gdb.cp/no-dmgl-verbose.exp: DMGL_VERBOSE-demangled f(std::string) is not defined This testcase was added back in 2011, here: [patch] Remove DMGL_VERBOSE https://sourceware.org/pipermail/gdb-patches/2011-June/083081.html Back then, the testcase would pass cleanly. It turns out that the reason it fails today is that the testcase is exercising something in GDB that only makes sense if the program is built for the pre-C++11 libstc++ ABI. Back then the C++11 ABI didn't exist yet, but nowadays, you need to compile with -D_GLIBCXX_USE_CXX11_ABI=0 to use the old ABI. See "Dual ABI" in the libstdc++ manual, at . If we tweak the gdb.cp/no-dmgl-verbose.exp testcase to force the old ABI with -D_GLIBCXX_USE_CXX11_ABI=0, then it passes cleanly. So why is it that setting a breakpoint at "f(std::string)" fails with modern ABI, but passes with old ABI? This is where libiberty demangler's DMGL_VERBOSE option comes in. The Itanium ABI mangling scheme has a shorthand form for std::string (and some other types). See : "In addition, the following catalog of abbreviations of the form "Sx" are used: ::= St # ::std:: ::= Sa # ::std::allocator ::= Sb # ::std::basic_string ::= Ss # ::std::basic_string < char, ::std::char_traits, ::std::allocator > ::= Si # ::std::basic_istream > ::= So # ::std::basic_ostream > ::= Sd # ::std::basic_iostream > " When the libiberty demangler encounters such a abbreviation, by default, it expands it to the user-friendly typedef "std::string", "std::iostream", etc.. If OTOH DMGL_VERBOSE is specified, the abbreviation is expanded to the underlying, non-typedefed fullname "std::basic_string, std::allocator >" etc. as documented in the Itanium ABI, and pasted above. You can see the standard abbreviations/substitutions in libiberty/cp-demangle.c:standard_subs. Back before Jan's patch in 2011, there were parts of GDB that used DMGL_VERBOSE, and others that did not, leading to mismatches. The solution back then was to stop using DMGL_VERBOSE throughout. GDB has code in place to let users set a breakpoint at a function with typedefs in its parameters, like "b f(uint32_t)". Demangled function names as they appear in the symbol tables almost (more on this is in a bit) never have typedefs in them, so when processing "b f(uint32_t)" GDB first replaces "uint32_t" for its underlying type, and then sets a breakpoint on the resulting prototype, in this case "f(unsigned int)". Now, if DMGL_VERBOSE is _not_ used, then the demangler demangles the mangled name of a function such as "void f(std::string)" that was mangled using the standard abbreviations mentioned above really as: "void f(std::string)". For example, the mangled name of "void f(std::string)" if you compile with old pre-C++11 ABI is "_Z1fSs". That uses the abbreviation "Ss", so if you demangle that without DMGL_VERBOSE, you get: $ echo "_Z1fSs" | c++filt --no-verbose f(std::string) while with DMGL_VERBOSE you'd get: $ echo "_Z1fSs" | c++filt f(std::basic_string, std::allocator >) If, when the user sets a breakpoint at "f(std::string)", GDB would replace the std::string typedef for its underlying type using the same mechanism I mentioned for the "f(uint32_t)" example above, then GDB would really try to set a breakpoint at "f(std::basic_string, std::allocator >)", and that would fail, as the function symbol GDB knows about for that function, given no DMGL_VERBOSE, is "f(std::string)". For this reason, the code that expands typedefs in function parameter names has an exception for std::string (and other standard abbreviation types), such that "std::string" is never typedef-expanded. And here lies the problem when you try to do "b f(std::string)" with a program compiled with the C++11 ABI. In that case, std::string expands to a different underlying type, like so: f(std::__cxx11::basic_string, std::allocator >) and this symbol naturally mangles differently, as: _Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE and then because this doesn't use the shorthand mangling abbreviation for "std::string" anymore, it always demangles as: f(std::__cxx11::basic_string, std::allocator >) Now, when using the C++11 ABI, and you set a breakpoint at "f(std::string)", GDB's typedefs-in-parameters expansion code hits the exception for "std::string" and doesn't expand it, so the breakpoint fails to be inserted, because the symbol that exists is really the f(std::__cxx11::basic_string, std::allocator >) one, not "f(std::string)". So to fix things for C++11 ABI, clearly we need to remove the "std::string" exception from the typedef-in-parameters expansion logic. If we do just that, then "b f(std::string)" starts working with the C++11 ABI. However, if we do _just_ that, and nothing else, then we break pre-C++11 ABI... The solution is then to in addition switch GDB to always use DMGL_VERBOSE. If we do this, then pre-C++11 ABI symbols works the same as C++11 ABI symbols overall -- the demangler expands the standard abbreviation for "std::string" as "std::basic_string, std::allocator >" and letting GDB expand the "std::string" typedef (etc.) too is no longer a problem. To avoid getting in the situation where some parts of GDB use DMGL_VERBOSE and others not, this patch adds wrappers around the demangler's entry points that GDB uses, and makes those force DMGL_VERBOSE. The point of the gdb.cp/no-dmgl-verbose.exp testcase was to try to ensure that DMGL_VERBOSE doesn't creep back in: gdb_test {break 'f(std::basic_string, std::allocator >)'} \ {Function ".*" not defined\.} \ "DMGL_VERBOSE-demangled f(std::string) is not defined" This obviously no longer makes sense to have, since we now depend on DMGL_VERBOSE. So the patch replaces gdb.cp/no-dmgl-verbose.exp with a new gdb.cp/break-f-std-string.exp testcase whose purpose is to make sure that setting a breakpoint at "f(std::string)" works. It exercises both pre-C++11 ABI and C++11 ABI. Change-Id: Ib54fab4cf0fd307bfd55bf1dd5056830096a653b --- gdb/cp-name-parser.y | 12 +- gdb/cp-support.c | 45 +++++--- gdb/cp-support.h | 16 +++ ...-dmgl-verbose.cc => break-f-std-string.cc} | 0 gdb/testsuite/gdb.cp/break-f-std-string.exp | 105 ++++++++++++++++++ gdb/testsuite/gdb.cp/no-dmgl-verbose.exp | 35 ------ 6 files changed, 154 insertions(+), 59 deletions(-) rename gdb/testsuite/gdb.cp/{no-dmgl-verbose.cc => break-f-std-string.cc} (100%) create mode 100644 gdb/testsuite/gdb.cp/break-f-std-string.exp delete mode 100644 gdb/testsuite/gdb.cp/no-dmgl-verbose.exp diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index 6410363c87f..4d33e7d4a07 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -1948,19 +1948,15 @@ allocate_info (void) return info; } -/* Convert RESULT to a string. The return value is allocated - using xmalloc. ESTIMATED_LEN is used only as a guide to the - length of the result. This functions handles a few cases that - cplus_demangle_print does not, specifically the global destructor - and constructor labels. */ +/* See cp-support.h. */ gdb::unique_xmalloc_ptr cp_comp_to_string (struct demangle_component *result, int estimated_len) { size_t err; - char *res = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, - result, estimated_len, &err); + char *res = gdb_cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, + result, estimated_len, &err); return gdb::unique_xmalloc_ptr (res); } @@ -2060,7 +2056,7 @@ cp_print (struct demangle_component *result) char *str; size_t err = 0; - str = cplus_demangle_print (DMGL_PARAMS | DMGL_ANSI, result, 64, &err); + str = gdb_cplus_demangle_print (result, 64, &err); if (str == NULL) return; diff --git a/gdb/cp-support.c b/gdb/cp-support.c index f52055893d2..71c14635e38 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -70,18 +70,16 @@ static void add_symbol_overload_list_qualified struct cmd_list_element *maint_cplus_cmd_list = NULL; -/* A list of typedefs which should not be substituted by replace_typedefs. */ -static const char * const ignore_typedefs[] = - { - "std::istream", "std::iostream", "std::ostream", "std::string" - }; - static void replace_typedefs (struct demangle_parse_info *info, struct demangle_component *ret_comp, canonicalization_ftype *finder, void *data); +static struct demangle_component * + gdb_cplus_demangle_v3_components (const char *mangled, + int options, void **mem); + /* A convenience function to copy STRING into OBSTACK, returning a pointer to the newly allocated string and saving the number of bytes saved in LEN. @@ -146,13 +144,6 @@ inspect_type (struct demangle_parse_info *info, memcpy (name, ret_comp->u.s_name.s, ret_comp->u.s_name.len); name[ret_comp->u.s_name.len] = '\0'; - /* Ignore any typedefs that should not be substituted. */ - for (const char *ignorable : ignore_typedefs) - { - if (strcmp (name, ignorable) == 0) - return 0; - } - sym = NULL; try @@ -670,8 +661,8 @@ mangled_name_to_comp (const char *mangled_name, int options, { struct demangle_component *ret; - ret = cplus_demangle_v3_components (mangled_name, - options, memory); + ret = gdb_cplus_demangle_v3_components (mangled_name, + options, memory); if (ret) { std::unique_ptr info (new demangle_parse_info); @@ -1635,7 +1626,7 @@ gdb_demangle (const char *name, int options) #endif if (crash_signal == 0) - result.reset (bfd_demangle (NULL, name, options)); + result.reset (bfd_demangle (NULL, name, options | DMGL_VERBOSE)); #ifdef HAVE_WORKING_FORK if (catch_demangler_crashes) @@ -1670,6 +1661,28 @@ gdb_demangle (const char *name, int options) /* See cp-support.h. */ +char * +gdb_cplus_demangle_print (int options, + struct demangle_component *tree, + int estimated_length, + size_t *p_allocated_size) +{ + return cplus_demangle_print (options | DMGL_VERBOSE, tree, + estimated_length, p_allocated_size); +} + +/* A wrapper for cplus_demangle_v3_components that forces + DMGL_VERBOSE. */ + +static struct demangle_component * +gdb_cplus_demangle_v3_components (const char *mangled, + int options, void **mem) +{ + return cplus_demangle_v3_components (mangled, options | DMGL_VERBOSE, mem); +} + +/* See cp-support.h. */ + unsigned int cp_search_name_hash (const char *search_name) { diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 4fbd53c8923..2e0ad50d2b9 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -175,6 +175,9 @@ struct type *cp_find_type_baseclass_by_name (struct type *parent_type, extern std::unique_ptr cp_demangled_name_to_comp (const char *demangled_name, std::string *errmsg); +/* Convert RESULT to a string. ESTIMATED_LEN is used only as a guide + to the length of the result. */ + extern gdb::unique_xmalloc_ptr cp_comp_to_string (struct demangle_component *result, int estimated_len); @@ -186,10 +189,23 @@ extern void cp_merge_demangle_parse_infos (struct demangle_parse_info *, extern struct cmd_list_element *maint_cplus_cmd_list; +/* Wrappers for bfd and libiberty demangling entry points. Note they + all force DMGL_VERBOSE so that callers don't need to. This is so + that GDB consistently uses DMGL_VERBOSE throughout -- we want + libiberty's demangler to expand standard substitutions to their + full template name. */ + /* A wrapper for bfd_demangle. */ gdb::unique_xmalloc_ptr gdb_demangle (const char *name, int options); +/* A wrapper for cplus_demangle_print. */ + +extern char *gdb_cplus_demangle_print (int options, + struct demangle_component *tree, + int estimated_length, + size_t *p_allocated_size); + /* Find an instance of the character C in the string S that is outside of all parenthesis pairs, single-quoted strings, and double-quoted strings. Also, ignore the char within a template name, like a ',' diff --git a/gdb/testsuite/gdb.cp/no-dmgl-verbose.cc b/gdb/testsuite/gdb.cp/break-f-std-string.cc similarity index 100% rename from gdb/testsuite/gdb.cp/no-dmgl-verbose.cc rename to gdb/testsuite/gdb.cp/break-f-std-string.cc diff --git a/gdb/testsuite/gdb.cp/break-f-std-string.exp b/gdb/testsuite/gdb.cp/break-f-std-string.exp new file mode 100644 index 00000000000..0869912bb29 --- /dev/null +++ b/gdb/testsuite/gdb.cp/break-f-std-string.exp @@ -0,0 +1,105 @@ +# Copyright 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . */ + +# Test setting a breakpoint at "f(std::string)". +# +# GDB should be able to expand the std::string typedef, and then set +# the breakpoint using the resulting name. In the Itanium ABI's +# mangling scheme, "std::string", "std::istream", "std::iostream", +# "std::ostream" are special, though, they have corresponding standard +# abbreviations. The libiberty demangler only expands these standard +# abbreviations to their full non-typedef underlying type if the +# DMGL_VERBOSE option is requested. By default it expands them to the +# user-friendly "std::string", etc. typedefs. GDB didn't use to use +# that option, and would instead prevent expansion of the +# "std::string" (etc.) standard-abbreviation typedefs at +# breakpoint-set type, such that the function name used for function +# lookup would match the "std::string" present in the function's +# non-DMGL_VERBOSE demangled name. +# +# For example (DMGL_VERBOSE): +# +# $ echo "_Z1fSs" | c++filt +# f(std::basic_string, std::allocator >) +# +# vs (no DMGL_VERBOSE): +# +# $ echo "_Z1fSs" | c++filt --no-verbose +# f(std::string) +# +# This design broke setting a breakpoint at "f(std::string)" when the +# libstdc++ C++11 ABI was introduced, as the "f(std::string)" +# function's mangled name no longer uses a standard substitution for +# std::string... +# +# I.e., with the libstdc++ C++11 ABI, we now have (and DMGL_VERBOSE +# makes no difference): +# +# $ echo _Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE | c++filt +# f(std::__cxx11::basic_string, std::allocator >) +# +# So nowadays, GDB always uses DMGL_VERBOSE and no longer prevents +# std::string (etc.) typedef expansion. This test exercises both +# pre-C++11 and C++11 ABIs for this reason. On non-libstdc++ systems +# where _GLIBCXX_USE_CXX11_ABI has no effect, we just end up running +# the test twice with whatever ABI is used. + +standard_testfile .cc + +if { [skip_cplus_tests] } { continue } + +# CXX11_ABI specifies the value to define _GLIBCXX_USE_CXX11_ABI as. + +proc test {cxx11_abi} { + global srcdir subdir srcfile binfile testfile + + set options \ + [list c++ debug additional_flags=-D_GLIBCXX_USE_CXX11_ABI=$cxx11_abi] + if { [gdb_compile \ + "${srcdir}/${subdir}/${srcfile}" "${binfile}-${cxx11_abi}.o" \ + object $options] != "" } { + untested "failed to compile" + return -1 + } + + clean_restart ${testfile}-${cxx11_abi}.o + + # Since we're debugging an .o file, GDB doesn't figure out we're + # debugging C++ code and the current language when auto, is + # guessed as C. + gdb_test_no_output "set language c++" + + # Get the type std::string is a typedef for. We'll try to set a + # breakpoint using the expanded type too. + set realtype "" + set type "std::string" + gdb_test_multiple "whatis /r $type" "" { + -re -wrap "type = (\[^\r\n\]+)" { + set realtype $expect_out(1,string) + gdb_assert {![string eq "$realtype" "$type"]} \ + $gdb_test_name + } + } + + gdb_test "break f($type)" "$srcfile, line $::decimal\\." + + if { $realtype != "" } { + gdb_test "break f($realtype)" "$srcfile, line $::decimal\\." + } +} + +foreach_with_prefix _GLIBCXX_USE_CXX11_ABI {0 1} { + test $_GLIBCXX_USE_CXX11_ABI +} diff --git a/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp b/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp deleted file mode 100644 index 14f11ddcf04..00000000000 --- a/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2011-2022 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . */ - -# Test loading symbols from unrelocated C++ object files. - -standard_testfile .cc - -if { [skip_cplus_tests] } { continue } - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {c++ debug}] != "" } { - untested "failed to compile" - return -1 -} - -clean_restart ${testfile}.o - -gdb_test_no_output "set breakpoint pending off" - -gdb_breakpoint {'f(std::string)'} - -gdb_test {break 'f(std::basic_string, std::allocator >)'} \ - {Function ".*" not defined\.} \ - "DMGL_VERBOSE-demangled f(std::string) is not defined" base-commit: 0ee8858e7aeca5ba5f702204daad2ddd290ef229 -- 2.36.0