public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Ijaz, Abdul B" <abdul.b.ijaz@intel.com>
To: Tom Tromey <tom@tromey.com>,
	Andrew Burgess <andrew.burgess@embecosm.com>
Cc: abdul.b.ijaz <abijaz@ecsmtp.iul.intel.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	"Kempke, Nils-Christian" <nils-christian.kempke@intel.com>
Subject: RE: [PATCH 1/1] gdb: Fix arrays of variable length strings for FORTRAN
Date: Mon, 11 Apr 2022 14:51:16 +0000	[thread overview]
Message-ID: <CO1PR11MB4788FBE21A7777F1322BFE6ECBEA9@CO1PR11MB4788.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CO1PR11MB47882920BEBE5C87DC8E1FBFCB449@CO1PR11MB4788.namprd11.prod.outlook.com>

Hi Tom,

Reminder to the last query. If it is fine can we merge this patch since it is not breaking existing functionality.  Thanks

Best Regards
Abdul Basit

-----Original Message-----
From: Ijaz, Abdul B <abdul.b.ijaz@intel.com> 
Sent: Wednesday, December 29, 2021 12:31 PM
To: Tom Tromey <tom@tromey.com>; Andrew Burgess <andrew.burgess@embecosm.com>
Cc: abdul.b.ijaz <abijaz@ecsmtp.iul.intel.com>; gdb-patches@sourceware.org
Subject: RE: [PATCH 1/1] gdb: Fix arrays of variable length strings for FORTRAN

Hi Tom and Andrew,

I do not feel so comfortable to modify generic code and my break things because of not having full overview. Will it be fine to merge this change if it is fine and not breaking anything or how shall we proceed on this. Thanks

Best Regards
Abdul Basit 

-----Original Message-----
From: Tom Tromey <tom@tromey.com>
Sent: Friday, August 27, 2021 7:03 PM
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: Tom Tromey <tom@tromey.com>; Ijaz, Abdul B <abdul.b.ijaz@intel.com>; abdul.b.ijaz <abijaz@ecsmtp.iul.intel.com>; gdb-patches@sourceware.org
Subject: Re: [PATCH 1/1] gdb: Fix arrays of variable length strings for FORTRAN

>> >> case TYPE_CODE_ARRAY:
>> >> +    case TYPE_CODE_STRING:
>> >> c_value_print_array (val, stream, recurse, options); break;
>> 
Andrew> I don't understand what part this change plays in this patch.  I 
Andrew> can see below how you're now creating values with 
Andrew> TYPE_CODE_STRING instead of TYPE_CODE_ARRAY, but then I'd expect 
Andrew> these to be covered by the existing handling of TYPE_CODE_STRING 
Andrew> in f_language::value_print_inner.

>> I wonder if this should go in generic_value_print instead.

Andrew> generic_val_print_array doesn't print arrays of character type 
Andrew> things as a string, so I think having this change in 
Andrew> c_value_print_inner makes sense.

In this case, though, the patch is adding new treatment for TYPE_CODE_STRING.  It seems to me that it would make sense to handle this in the generic code.

Andrew> I did wonder if we should _also_ change generic_val_print 
Andrew> though, as this would catch any language that wasn't Fortran, C, 
Andrew> or C++ that called into generic_val_print and didn't already 
Andrew> handle TYPE_CODE_STRING.

Yeah.

Andrew> However, that's only Modula2 and Pascal, both of which already 
Andrew> handle TYPE_CODE_ARRAY and do something similar to C's print 
Andrew> character types as a string, which leads me to think that maybe 
Andrew> both of these languages should be handling TYPE_CODE_STRING as 
Andrew> an alias for TYPE_CODE_ARRAY.

That would be fine as well.  It's still often useful for the generic code to handle a case, because users can language-switch and wind up printing an "unexpected" type via the "wrong" language, like:

(gdb) print value_of_type_code_string
(gdb) set lang c
(gdb) print $

Andrew> I'm also tempted to say that the Modula2 and Pascal changes are 
Andrew> optional, as that seems like an edge case (user debugging 
Andrew> Fortran code with the language forced to one of those two choices).

This should do something sensible when possible.  It doesn't always -- sometimes the languages have special code to decode things.  But, that seems like a not very good way to do it to me; better instead to unify the type system and then the fallback code can do something useful, even if not fully correct for the current language (which isn't always possible).

One question for me is, if TYPE_CODE_STRING is a string, can we avoid language-specific code for it at all?  And just always handle it in the generic code.

Tom
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

  reply	other threads:[~2022-04-11 14:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 11:06 [PATCH 0/1] Fix variable length strings array " abdul.b.ijaz
2021-08-20 11:06 ` [PATCH 1/1] gdb: Fix arrays of variable length strings " abdul.b.ijaz
2021-08-20 15:52   ` Andrew Burgess
2021-08-23  8:47     ` Ijaz, Abdul B
2021-08-25  8:36       ` Andrew Burgess
2021-08-27  9:11         ` Ijaz, Abdul B
2021-08-23 20:54     ` Tom Tromey
2021-08-25  8:56       ` Andrew Burgess
2021-08-27 17:02         ` Tom Tromey
2021-12-29 11:31           ` Ijaz, Abdul B
2022-04-11 14:51             ` Ijaz, Abdul B [this message]
2022-04-15 16:33             ` Tom Tromey
2021-08-20 17:02   ` 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=CO1PR11MB4788FBE21A7777F1322BFE6ECBEA9@CO1PR11MB4788.namprd11.prod.outlook.com \
    --to=abdul.b.ijaz@intel.com \
    --cc=abijaz@ecsmtp.iul.intel.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nils-christian.kempke@intel.com \
    --cc=tom@tromey.com \
    /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).