From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Subject: [PATCHv2 01/18] gdb: Convert la_struct_too_deep_ellipsis to a method
Date: Wed, 5 Aug 2020 15:45:36 +0100 [thread overview]
Message-ID: <c761fe5e46c1e782930455c0cf46e054acfd823f.1596638295.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1596638295.git.andrew.burgess@embecosm.com>
Convert language_data::la_struct_too_deep_ellipsis member variable to
a method in language_defn.
There should be no user visible changes after this commit.
gdb/ChangeLog:
* ada-lang.c (ada_language_data): Remove
la_struct_too_deep_ellipsis initializer.
(ada_language::struct_too_deep_ellipsis): New member function.
* c-lang.c (c_language_data): Remove la_struct_too_deep_ellipsis
initializer.
(cplus_language_data): Likewise.
(asm_language_data): Likewise.
(minimal_language_data): Likewise.
* cp-valprint.c (cp_print_value): Update call to
struct_too_deep_ellipsis.
* d-lang.c (d_language_data): Remove la_struct_too_deep_ellipsis
initializer.
* f-lang.c (f_language_data): Likewise.
(f_language::struct_too_deep_ellipsis): New member function.
* go-lang.c (go_language_data): Remove la_struct_too_deep_ellipsis
initializer.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_struct_too_deep_ellipsis
member variable.
(language_defn::struct_too_deep_ellipsis): New member function.
* m2-lang.c (m2_language_data): Remove la_struct_too_deep_ellipsis
initializer.Q
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.
* valprint.c (val_print_check_max_depth): Update call to
struct_too_deep_ellipsis.
---
gdb/ChangeLog | 32 ++++++++++++++++++++++++++++++++
gdb/ada-lang.c | 5 ++++-
gdb/c-lang.c | 4 ----
gdb/cp-valprint.c | 4 ++--
gdb/d-lang.c | 1 -
gdb/f-lang.c | 6 +++++-
gdb/go-lang.c | 1 -
gdb/language.c | 2 --
gdb/language.h | 16 ++++++++++------
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 -
gdb/valprint.c | 4 ++--
15 files changed, 55 insertions(+), 25 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 29951528e5e..835bbf2abf6 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -13729,7 +13729,6 @@ extern const struct language_data ada_language_data =
0, /* c-style arrays */
1, /* String lower bound */
&ada_varobj_ops,
- "(...)" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Ada language. */
@@ -14187,6 +14186,10 @@ class ada_language : public language_defn
return ada_is_string_type (type);
}
+ /* See language.h. */
+
+ const char *struct_too_deep_ellipsis () const override
+ { return "(...)"; }
protected:
/* See language.h. */
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index f29f2cef610..36c49f7c8a2 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -895,7 +895,6 @@ extern const struct language_data c_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&c_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the C language. */
@@ -996,7 +995,6 @@ extern const struct language_data cplus_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&cplus_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* A class for the C++ language. */
@@ -1194,7 +1192,6 @@ extern const struct language_data asm_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* A class for the ASM language. */
@@ -1250,7 +1247,6 @@ extern const struct language_data minimal_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* A class for the minimal language. */
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index a02fee6b552..819736dac9e 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -499,8 +499,8 @@ cp_print_value (struct value *val, struct ui_file *stream,
&& recurse >= options->max_depth)
{
const struct language_defn *language = current_language;
- gdb_assert (language->la_struct_too_deep_ellipsis != NULL);
- fputs_filtered (language->la_struct_too_deep_ellipsis, stream);
+ gdb_assert (language->struct_too_deep_ellipsis () != NULL);
+ fputs_filtered (language->struct_too_deep_ellipsis (), stream);
}
else
{
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 4ebb011ee9b..b027c89ff8e 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -148,7 +148,6 @@ extern const struct language_data d_language_data =
1, /* C-style arrays. */
0, /* String lower bound. */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the D language. */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 58b41d11d11..c9320012923 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -508,7 +508,6 @@ extern const struct language_data f_language_data =
0, /* arrays are first-class (not c-style) */
1, /* String lower bound */
&default_varobj_ops,
- "(...)" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Fortran language. */
@@ -707,6 +706,11 @@ class f_language : public language_defn
&& TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR));
}
+ /* See language.h. */
+
+ const char *struct_too_deep_ellipsis () const override
+ { return "(...)"; }
+
protected:
/* See language.h. */
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index cb42ef1b7cf..deff33a8abf 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -523,7 +523,6 @@ extern const struct language_data go_language_data =
1, /* C-style arrays. */
0, /* String lower bound. */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Go language. */
diff --git a/gdb/language.c b/gdb/language.c
index c993cfc57a6..914c75b08e7 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -798,7 +798,6 @@ extern const struct language_data unknown_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the unknown language. */
@@ -924,7 +923,6 @@ extern const struct language_data auto_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the fake "auto" language. */
diff --git a/gdb/language.h b/gdb/language.h
index d2e5b733077..f2195ed4e8d 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -266,12 +266,6 @@ struct language_data
/* Various operations on varobj. */
const struct lang_varobj_ops *la_varobj_ops;
-
- /* 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;
-
};
/* Base class from which all other language classes derive. */
@@ -553,6 +547,16 @@ struct language_defn : language_data
/* Return true if TYPE is a string type. */
virtual bool is_string_type_p (struct type *type) const;
+ /* Return a string that 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. The default value here
+ suits most languages. If overriding then the string here should
+ ideally be similar in style to the default; an opener, three '.', and
+ a closer. */
+
+ virtual const char *struct_too_deep_ellipsis () const
+ { return "{...}"; }
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index 2c39359d289..9e2d0d75f17 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -214,7 +214,6 @@ extern const struct language_data m2_language_data =
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the M2 language. */
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 63cdac1b035..00d77041b45 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -343,7 +343,6 @@ extern const struct language_data objc_language_data =
1, /* C-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Objective-C language. */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index eccf1df9621..dade720cd53 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1022,7 +1022,6 @@ extern const struct language_data opencl_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the OpenCL language. */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 07afbdda5bb..2a6389344da 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -272,7 +272,6 @@ extern const struct language_data pascal_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Pascal language. */
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index ddd4b57d294..a903dae1758 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -1926,7 +1926,6 @@ extern const struct language_data rust_language_data =
1, /* c-style arrays */
0, /* String lower bound */
&default_varobj_ops,
- "{...}" /* la_struct_too_deep_ellipsis */
};
/* Class representing the Rust language. */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index db98ca2abc9..f3519bdc954 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -997,8 +997,8 @@ val_print_check_max_depth (struct ui_file *stream, int recurse,
{
if (options->max_depth > -1 && recurse >= options->max_depth)
{
- gdb_assert (language->la_struct_too_deep_ellipsis != NULL);
- fputs_filtered (language->la_struct_too_deep_ellipsis, stream);
+ gdb_assert (language->struct_too_deep_ellipsis () != NULL);
+ fputs_filtered (language->struct_too_deep_ellipsis (), stream);
return true;
}
--
2.25.4
next prev parent reply other threads:[~2020-08-05 14:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 14:45 [PATCHv2 00/18] Further updates for the language class structure Andrew Burgess
2020-08-05 14:45 ` Andrew Burgess [this message]
2020-08-05 14:45 ` [PATCHv2 02/18] gdb: Convert la_name_of_this to a method Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 03/18] gdb: Convert la_name and la_natural_name to methods Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 04/18] gdb: Convert la_filename_extensions to a method Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 05/18] gdb: Move la_language into the language_defn class Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 06/18] gdb: Convert language_data::c_style_arrays to a method Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 07/18] gdb: Fix an incorrect comment Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 08/18] gdb: Convert language_data::string_lower_bound to a method Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 09/18] gdb: Convert la_store_sym_names_in_linkage_form_p " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 10/18] gdb: Override store_sym_names_in_linkage_form_p for Go language Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 11/18] gdb: Convert language_data::la_range_check to a method Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 12/18] gdb: Convert language_data::la_case_sensitivity " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 13/18] gdb: Convert language_data::la_array_ordering " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 14/18] gdb: Convert language_data::la_macro_expansion " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 15/18] gdb: Convert language_data::la_varobj_ops " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 16/18] gdb: Convert language_data::la_exp_desc " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 17/18] gdb: Convert language_data::la_op_print_tab " Andrew Burgess
2020-08-05 14:45 ` [PATCHv2 18/18] gdb: Remove language_data struct Andrew Burgess
2020-09-03 16:00 ` [PATCHv2 00/18] Further updates for the language class structure Andrew Burgess
2020-09-16 10:06 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c761fe5e46c1e782930455c0cf46e054acfd823f.1596638295.git.andrew.burgess@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).