From 5cc0917c387350c47c350843e3b7a16059345529 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 19 Nov 2020 17:52:00 +0000 Subject: gdb: remove some uses of LA_PRINT_STRING This commit removes some, but not all, uses of LA_PRINT_STRING. In this commit I've removed those uses where there is an obvious language object on which I can instead call the printstr method. In the remaining 3 uses it is harder to know if the correct thing is to call printstr on the current language, or on a specific language. Currently obviously, we always call on the current language (as that's what LA_PRINT_STRING does), and clearly this behaviour is good enough right now, but is it "right"? I've left them for now and will give them more thought in the future. gdb/ChangeLog: * expprint.c (print_subexp_standard): Replace uses of LA_PRINT_STRING. * f-valprint.c (f_language::value_print_inner): Likewise. * guile/scm-pretty-print.c (ppscm_print_string_repr): Likewise. * p-valprint.c (pascal_language::value_print_inner): Likewise. * python/py-prettyprint.c (print_string_repr): Likewise. --- gdb/expprint.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gdb/expprint.c') diff --git a/gdb/expprint.c b/gdb/expprint.c index 5b4ea14..51dbc56 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -226,9 +226,10 @@ print_subexp_standard (struct expression *exp, int *pos, If necessary, we can temporarily set it to zero, or pass it as an additional parameter to LA_PRINT_STRING. -fnf */ get_user_print_options (&opts); - LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char, - (gdb_byte *) &exp->elts[pc + 2].string, nargs, - NULL, 0, &opts); + exp->language_defn + ->printstr (stream, builtin_type (exp->gdbarch)->builtin_char, + (gdb_byte *) &exp->elts[pc + 2].string, nargs, + NULL, 0, &opts); } return; @@ -241,9 +242,10 @@ print_subexp_standard (struct expression *exp, int *pos, (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1); fputs_filtered ("@\"", stream); get_user_print_options (&opts); - LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char, - (gdb_byte *) &exp->elts[pc + 2].string, nargs, - NULL, 0, &opts); + exp->language_defn + ->printstr (stream, builtin_type (exp->gdbarch)->builtin_char, + (gdb_byte *) &exp->elts[pc + 2].string, nargs, + NULL, 0, &opts); fputs_filtered ("\"", stream); } return; @@ -325,8 +327,9 @@ print_subexp_standard (struct expression *exp, int *pos, struct value_print_options opts; get_user_print_options (&opts); - LA_PRINT_STRING (stream, builtin_type (exp->gdbarch)->builtin_char, - (gdb_byte *) tempstr, nargs - 1, NULL, 0, &opts); + exp->language_defn + ->printstr (stream, builtin_type (exp->gdbarch)->builtin_char, + (gdb_byte *) tempstr, nargs - 1, NULL, 0, &opts); (*pos) = pc; } else -- cgit v1.1