From patchwork Tue Apr 16 23:06:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 32314 Received: (qmail 76892 invoked by alias); 16 Apr 2019 23:06:25 -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 76840 invoked by uid 89); 16 Apr 2019 23:06:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 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= X-HELO: mail-wm1-f41.google.com Received: from mail-wm1-f41.google.com (HELO mail-wm1-f41.google.com) (209.85.128.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Apr 2019 23:06:23 +0000 Received: by mail-wm1-f41.google.com with SMTP id 4so1034308wmf.1 for ; Tue, 16 Apr 2019 16:06:22 -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=zNhA93XPUa5DevPYXXPKubXRyb2xLXyZNKibJON2nEQ=; b=WoL6yvaIuBIWlxQ/oo2kU0EvRWo5mheDMoKM2F3QnN0Ayg5ubQKCSVcSnegBhV9DOU auLv4+606iisfOe1kF7hmxCPA4Iix6YZwZjjIK8PBMekP8a0ucbr7kFER4oSWqlwP60l FjIxubI6E+XHS6o82gxds4XAzTRO+6b0Nbxq5n7ADIP9UjHQdXvlToamYw26RQmMc7D/ R9y9Zos+3K+u8YzI2aKluwj/2Ypv7zy7bXsxyGRvbAl5x5bvt7bbr4K7qw0i4fUl/6s3 WwPZHIX70t6KG1O9yceVzofMF7ugiYuvBCpQw7nzTLzvdvr+62MdPIJpXeBMVsMNDwAA wZ9A== Return-Path: Received: from localhost (host86-164-133-98.range86-164.btcentralplus.com. [86.164.133.98]) by smtp.gmail.com with ESMTPSA id s21sm27985695wra.45.2019.04.16.16.06.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Apr 2019 16:06:19 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv2 3/5] gdb: Introduce new language field la_struct_too_deep_ellipsis Date: Wed, 17 Apr 2019 00:06:08 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-IsSubscribed: yes This commit is preparation work for a later 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 | 3 ++- gdb/c-lang.c | 12 ++++++++---- gdb/d-lang.c | 3 ++- gdb/f-lang.c | 3 ++- gdb/go-lang.c | 3 ++- gdb/language.c | 6 ++++-- gdb/language.h | 6 ++++++ gdb/m2-lang.c | 3 ++- gdb/objc-lang.c | 3 ++- gdb/opencl-lang.c | 3 ++- gdb/p-lang.c | 3 ++- gdb/rust-lang.c | 3 ++- 13 files changed, 56 insertions(+), 15 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 622cf59de68..fddb0d7278c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -14380,7 +14380,8 @@ extern const struct language_defn ada_language_defn = { default_search_name_hash, &ada_varobj_ops, NULL, - NULL + NULL, + "(...)" /* la_struct_too_deep_ellipsis */ }; /* Command-list for the "set/show ada" prefix command. */ diff --git a/gdb/c-lang.c b/gdb/c-lang.c index 33506f1d1ed..3be5ef57252 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -873,7 +873,8 @@ extern const struct language_defn c_language_defn = default_search_name_hash, &c_varobj_ops, c_get_compile_context, - c_compute_program + c_compute_program, + "{...}" /* la_struct_too_deep_ellipsis */ }; enum cplus_primitive_types { @@ -1017,7 +1018,8 @@ extern const struct language_defn cplus_language_defn = cp_search_name_hash, &cplus_varobj_ops, cplus_get_compile_context, - cplus_compute_program + cplus_compute_program, + "{...}" /* la_struct_too_deep_ellipsis */ }; static const char *asm_extensions[] = @@ -1070,7 +1072,8 @@ extern const struct language_defn asm_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; /* The following language_defn does not represent a real language. @@ -1123,5 +1126,6 @@ extern const struct language_defn minimal_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/d-lang.c b/gdb/d-lang.c index 08b638009ff..751c521a75d 100644 --- a/gdb/d-lang.c +++ b/gdb/d-lang.c @@ -250,7 +250,8 @@ extern const struct language_defn d_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; /* Build all D language types for the specified architecture. */ diff --git a/gdb/f-lang.c b/gdb/f-lang.c index f3a806e7a6f..77eb50a0761 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -377,7 +377,8 @@ extern const struct language_defn f_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "(...)" /* la_struct_too_deep_ellipsis */ }; static void * diff --git a/gdb/go-lang.c b/gdb/go-lang.c index f74cee4ccd8..b8617cb162d 100644 --- a/gdb/go-lang.c +++ b/gdb/go-lang.c @@ -611,7 +611,8 @@ extern const struct language_defn go_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; static void * diff --git a/gdb/language.c b/gdb/language.c index 954e4c200f0..da8dd1bf7ae 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -876,7 +876,8 @@ const struct language_defn unknown_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; /* These two structs define fake entries for the "local" and "auto" @@ -926,7 +927,8 @@ const struct language_defn auto_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/language.h b/gdb/language.h index 3e0bc9d0d46..261f5a33cc7 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -449,6 +449,12 @@ struct language_defn struct gdbarch *gdbarch, 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; + }; /* Pointer to the language_defn for our current language. This pointer diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index b4eb2628571..9f2a97d54fd 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -398,7 +398,8 @@ extern const struct language_defn m2_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; static void * diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 1853a69e754..af92e55a437 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -408,7 +408,8 @@ extern const struct language_defn objc_language_defn = { default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; /* diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index c1ea66eea39..c95bf05a98b 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -1086,7 +1086,8 @@ extern const struct language_defn opencl_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; static void * diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 9340861761b..0b85f70dfd2 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -459,5 +459,6 @@ extern const struct language_defn pascal_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ }; diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 9a123c338ef..8faafd49cdd 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -2141,5 +2141,6 @@ extern const struct language_defn rust_language_defn = default_search_name_hash, &default_varobj_ops, NULL, - NULL + NULL, + "{...}" /* la_struct_too_deep_ellipsis */ };