From patchwork Wed Mar 27 21:53:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 32036 Received: (qmail 74270 invoked by alias); 27 Mar 2019 21:53:35 -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 74100 invoked by uid 89); 27 Mar 2019 21:53:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=2516, sk:cplus_l, sk:pascal_ X-HELO: mail-wr1-f66.google.com Received: from mail-wr1-f66.google.com (HELO mail-wr1-f66.google.com) (209.85.221.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Mar 2019 21:53:32 +0000 Received: by mail-wr1-f66.google.com with SMTP id q1so20412094wrp.0 for ; Wed, 27 Mar 2019 14:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=5ZqTX1ZAzJIQscQtnkgfB9oYX4trjSUlAJpG4ttw060=; b=WHXA4cWVZeRMQaqN/e2d5h8zfCjDvQrVDkeFLtjYKgOzd531w1Yyn5W0wVsZJfZfSt TTo71cYrw1m9tgsGK60RowATZocgbQmdK+OC5qZG96j690XUTo5AJPr1ULLxmWiSBRZM DAXZYhL0NmHclVsyxyg2aV3r32voY/zSKW5Ky2IlusoNBtihFNeQGnGmfsiR9SFXI4K1 0BIV30yEA72uJFQaJfFBpxoquCvjlxGyTCEVtmAGlwONozJXFVEmUR1aWlB/aza6UMGR 3xISfPiGmmXt/S4KJRn+Z4TW9QRgLgWQvr0H4KAV95hc6S0baU600We/xUbP/iKoKfaR EaNg== Return-Path: Received: from localhost (host81-151-161-58.range81-151.btcentralplus.com. [81.151.161.58]) by smtp.gmail.com with ESMTPSA id y9sm767207wrn.18.2019.03.27.14.53.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2019 14:53:29 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: richard.bunt@arm.com, Andrew Burgess Subject: [PATCH 1/2] gdb: Introduce new language field la_struct_too_deep_ellipsis Date: Wed, 27 Mar 2019 21:53:23 +0000 Message-Id: <35229a127e8738238fd4a5f47ad7af54edf20446.1553723416.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes This commit is preparation work for the next commit, and by itself makes no user visible change to GDB. I've split this work into a separate commit in order to make code review easier. This commit adds a new field 'la_struct_too_deep_ellipsis' to the language struct, this string will be used in the next commit to print a language specific string from within the generic value printing code. In this commit I add the new field and initialise it for each language, however at this stage the new field is never used. gdb/ChangeLog: * language.h (struct language_defn) : New field. * ada-lang.c (ada_language_defn): Initialise new field. * c-lang.c (c_language_defn): Likewise. (cplus_language_defn): Likewise. (asm_language_defn): Likewise. (minimal_language_defn): Likewise. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Likewise. * go-lang.c (go_language_defn): Likewise. * language.c (unknown_language_defn): Likewise. (auto_language_defn): Likewise. * m2-lang.c (m2_language_defn): Likewise. * objc-lang.c (objc_language_defn): Likewise. * opencl-lang.c (opencl_language_defn): Likewise. * p-lang.c (pascal_language_defn): Likewise. * rust-lang.c (rust_language_defn): Likewise. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/ada-lang.c | 1 + gdb/c-lang.c | 4 ++++ gdb/d-lang.c | 1 + gdb/f-lang.c | 1 + gdb/go-lang.c | 1 + gdb/language.c | 2 ++ gdb/language.h | 5 +++++ gdb/m2-lang.c | 1 + gdb/objc-lang.c | 1 + gdb/opencl-lang.c | 1 + gdb/p-lang.c | 1 + gdb/rust-lang.c | 1 + 13 files changed, 40 insertions(+) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 692d52a9551..b7cd63ab5a7 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -14380,6 +14380,7 @@ extern const struct language_defn ada_language_defn = { &ada_varobj_ops, NULL, NULL, + "(...)", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 36c750204da..cc414135be3 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -874,6 +874,7 @@ extern const struct language_defn c_language_defn = &c_varobj_ops, c_get_compile_context, c_compute_program, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; @@ -1019,6 +1020,7 @@ extern const struct language_defn cplus_language_defn = &cplus_varobj_ops, cplus_get_compile_context, cplus_compute_program, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; @@ -1073,6 +1075,7 @@ extern const struct language_defn asm_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; @@ -1127,5 +1130,6 @@ extern const struct language_defn minimal_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 637e012b32e..a5c8ce27941 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -251,6 +251,7 @@ extern const struct language_defn d_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 7bd119690b4..c894c105d16 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -378,6 +378,7 @@ extern const struct language_defn f_language_defn = &default_varobj_ops, NULL, NULL, + "(...)", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/go-lang.c b/gdb/go-lang.c index 5af88f805a7..9718c69c861 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -612,6 +612,7 @@ extern const struct language_defn go_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/language.c b/gdb/language.c index ea294e670b6..69696d62f6e 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -878,6 +878,7 @@ const struct language_defn unknown_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; @@ -929,6 +930,7 @@ const struct language_defn auto_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/language.h b/gdb/language.h index d56ec200208..ba875760f00 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -446,6 +446,11 @@ struct language_defn const struct block *expr_block, CORE_ADDR expr_pc); + /* This string is used by the 'set print max-depth' setting. When GDB + replaces a struct or union (during value printing) that is "too + deep" this string is displayed instead. */ + const char *la_struct_too_deep_ellipsis; + /* Add fields above this point, so the magic number is always last. */ /* Magic number for compat checking. */ diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 1a72aba73c9..004fd7022cb 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -399,6 +399,7 @@ extern const struct language_defn m2_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index ceef482ae35..2316f1e90e0 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -409,6 +409,7 @@ extern const struct language_defn objc_language_defn = { &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 03699b14251..7ab95c9a94a 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1087,6 +1087,7 @@ extern const struct language_defn opencl_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/p-lang.c b/gdb/p-lang.c index b61273f356b..c94ab5f21bb 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -460,5 +460,6 @@ extern const struct language_defn pascal_language_defn = &default_varobj_ops, NULL, NULL, + "{...}", /* la_struct_too_deep_ellipsis */ LANG_MAGIC }; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 0c6c13d738e..926580ff96c 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2143,5 +2143,6 @@ extern const struct language_defn rust_language_defn = &default_varobj_ops, NULL, NULL, + "(...)", /* la_struct_too_deep_ellipsis */ LANG_MAGIC };