Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wei-min Pan <weimin.pan@oracle.com>
To: Tom Tromey <tom@tromey.com>
Cc: Joel Brobecker <brobecker@adacore.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH PR gdb/20057] Internal error on trying to set {char[]}$pc="string"
Date: Thu, 29 Nov 2018 23:26:00 -0000	[thread overview]
Message-ID: <4107cd46-1978-93a8-1f54-6e1622ffe191@oracle.com> (raw)
In-Reply-To: <87lg5ba6vl.fsf@tromey.com>



On 11/29/2018 1:52 PM, Tom Tromey wrote:
>>>>>> ">" == Wei-min Pan <weimin.pan@oracle.com> writes:
>>> Looks like we have at least 2 options:
>>> (1) Making sure the type is objfile-owned before calling copy_type in
>>> resolve_dynamic_range and resolve_dynamic_array as you suggested, or
>>> (2) Replacing the assert with an objfile-owned check in copy_type, similar
>>> to what copy_type_recursive does.
> Sorry, I still didn't read the whole thread... but I think what to do
> depends on what is happening.
>
> Most callers of copy_type are probably copying it to modify the copy.
> If this is the case, then maybe just removing the assert is ok.
> Or, maybe it makes sense to understand why the modified type isn't
> objfile-allocated in the first place.
>
> Could you recap?  What is calling copy_type here and where did the type
> come from?
>
> Tom

Let's use an example:

(gdb) p {char []}$pc

if the element type "char" is defined in the program, i.e. it has an 
objfile,
lookup_array_range_type sets the "index type" with that objfile's 
builtin_int.
Otherwise, it sets it with gdbarch's built-in. The index type is then used
to create the range type and the array type. Thus the array type is entirely
either objfile-owned or gdbarch-owned.

Both resolve_dynamic_array and resolve_dynamic_range call copy_type to
allocate a type and yes modify it to represent a static version of the array
type from lookup_array_range_type() above.



  reply	other threads:[~2018-11-29 23:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-25  2:12 Weimin Pan
2018-01-25  4:14 ` Joel Brobecker
2018-01-25 22:24   ` Wei-min Pan
2018-01-31  7:45     ` Joel Brobecker
2018-02-01  1:46       ` Wei-min Pan
2018-02-01  8:00         ` Joel Brobecker
2018-02-02  1:14           ` Wei-min Pan
2018-11-14 23:38           ` Wei-min Pan
2018-11-14 23:51             ` Joel Brobecker
2018-11-15  0:16               ` Wei-min Pan
2018-11-29 19:18                 ` Tom Tromey
2018-11-29 21:10                   ` Wei-min Pan
2018-11-29 21:52                     ` Tom Tromey
2018-11-29 23:26                       ` Wei-min Pan [this message]
2018-11-30 15:37                         ` Tom Tromey
2018-11-30 17:31                           ` Wei-min Pan

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=4107cd46-1978-93a8-1f54-6e1622ffe191@oracle.com \
    --to=weimin.pan@oracle.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --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