public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "muller at sourceware dot org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug pascal/16016] ptype incorrectly shows "record" (pascal/struct) as class (if accessed via pointer) (7.6.1 regression)
Date: Mon, 24 Aug 2020 15:45:58 +0000	[thread overview]
Message-ID: <bug-16016-4717-s6mVY8O9HP@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-16016-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=16016

Pierre Muller <muller at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |muller at sourceware dot org

--- Comment #6 from Pierre Muller <muller at sourceware dot org> ---
  Issue confirmed for gdb-7.6 also,
the problem comes from a change of the 
type.main_type.type_specific.cplus_stuff
field due to RTTI reading.
  This suggest that Free Pascal also issues RTTI
information about 'record' not only 'classes',
which is probably true, but this is a branch of Free
Pascal compiler I do not know well...

  So if someone with more knowledge about that part can go further.

It seems that:
top> f 0
#0  0x005fbe0a in gnuv3_get_vtable (gdbarch=0x276e390,
container_type=0x2792090, container_addr=4243472) at
../../gdb-7.6/gdb/gnu-v3-abi.c:249
249       if (!gnuv3_dynamic_class (check_typedef (container_type)))
top> li
244       struct value *vtable_pointer;
245       CORE_ADDR vtable_address;
246
247       /* If this type does not have a virtual table, don't read the first
248          field.  */
249       if (!gnuv3_dynamic_class (check_typedef (container_type)))
250         return NULL;
here the call to gnuv3_dynamic_class  changes the cplus_stuff
from cplus_struct_default to a new 'struct', even if there
gnuv3_dynamic_class return false.
  I have no idea if this is expected behavior, but it does
indeed explain why 
pty TFOO 
generates a different output after 
p p1^
has been issued!


Pierre Muller



(gdb) p p1^
Hardware watchpoint 3: *$3

Old value = (struct cplus_struct_type *) 0x7b07c0 <cplus_struct_default>
New value = (struct cplus_struct_type *) 0x2792500
allocate_cplus_struct_type (type=0x2792090) at
../../gdb-7.6/gdb/gdbtypes.c:1932
1932      *(TYPE_RAW_CPLUS_SPECIFIC (type)) = cplus_struct_default;
top> bt
#0  allocate_cplus_struct_type (type=0x2792090) at
../../gdb-7.6/gdb/gdbtypes.c:1932
#1  0x005fbae0 in gnuv3_dynamic_class (type=0x2792090) at
../../gdb-7.6/gdb/gnu-v3-abi.c:206
#2  0x005fbe0a in gnuv3_get_vtable (gdbarch=0x276e390,
container_type=0x2792090, container_addr=4243472) at
../../gdb-7.6/gdb/gnu-v3-abi.c:249
#3  0x005fbf37 in gnuv3_rtti_type (value=0x2795f68, full_p=0x1e7f5e4,
top_p=0x1e7f5e0, using_enc_p=0x1e7f5dc) at ../../gdb-7.6/gdb/gnu-v3-abi.c:301
#4  0x005fdf21 in value_rtti_type (v=0x2795f68, full=0x1e7f5e4, top=0x1e7f5e0,
using_enc=0x1e7f5dc) at ../../gdb-7.6/gdb/cp-abi.c:120
#5  0x004c619c in value_full_object (argp=0x2795f68, rtype=0x0, xfull=0,
xtop=0, xusing_enc=0) at ../../gdb-7.6/gdb/valops.c:3604
#6  0x004b6e81 in readjust_indirect_value_type (value=0x2795f68,
enc_type=0x2792090, original_type=0x2792148, original_value=0x4656798) at
../../gdb-7.6/gdb/value.c:3277
#7  0x004c28db in value_ind (arg1=0x4656798) at ../../gdb-7.6/gdb/valops.c:1776
#8  0x004bda86 in evaluate_subexp_standard (expect_type=0x0, exp=0x279d7e0,
pos=0x1e7f99c, noside=EVAL_NORMAL) at ../../gdb-7.6/gdb/eval.c:2550
#9  0x004b71ee in evaluate_subexp (expect_type=0x0, exp=0x279d7e0,
pos=0x1e7f99c, noside=EVAL_NORMAL) at ../../gdb-7.6/gdb/eval.c:71
#10 0x004b736d in evaluate_expression (exp=0x279d7e0) at
../../gdb-7.6/gdb/eval.c:146
#11 0x004d10fa in print_command_1 (exp=0x2866f02 "p1^", voidprint=1) at
../../gdb-7.6/gdb/printcmd.c:965
#12 0x004d123f in print_command (exp=0x2866f02 "p1^", from_tty=1) at
../../gdb-7.6/gdb/printcmd.c:1006
#13 0x00449a90 in do_cfunc (c=0x2745890, args=0x2866f02 "p1^", from_tty=1) at
../../gdb-7.6/gdb/cli/cli-decode.c:113
#14 0x0044c263 in cmd_func (cmd=0x2745890, args=0x2866f02 "p1^", from_tty=1) at
../../gdb-7.6/gdb/cli/cli-decode.c:1859
#15 0x005ebf00 in execute_command (p=0x2866f04 "^", from_tty=1) at
../../gdb-7.6/gdb/top.c:484
#16 0x00516a4b in command_handler (command=0x2866f00 "p p1^") at
../../gdb-7.6/gdb/event-top.c:431
#17 0x00516f47 in command_line_handler (rl=0x4587840 "") at
../../gdb-7.6/gdb/event-top.c:629
#18 0x0062885e in rl_callback_read_char () at
../../gdb-7.6/readline/callback.c:220
#19 0x005165ff in rl_callback_read_char_wrapper (client_data=0x0) at
../../gdb-7.6/gdb/event-top.c:163
#20 0x00516972 in stdin_event_handler (error=0, client_data=0x0) at
../../gdb-7.6/gdb/event-top.c:371
#21 0x00515bab in handle_file_event (data=...) at
../../gdb-7.6/gdb/event-loop.c:768
#22 0x005152c8 in process_event () at ../../gdb-7.6/gdb/event-loop.c:342
#23 0x0051538d in gdb_do_one_event () at ../../gdb-7.6/gdb/event-loop.c:406
#24 0x005153de in start_event_loop () at ../../gdb-7.6/gdb/event-loop.c:431
#25 0x00516628 in cli_command_loop () at ../../gdb-7.6/gdb/event-top.c:176
#26 0x0050de2d in current_interp_command_loop () at
../../gdb-7.6/gdb/interps.c:331
#27 0x0050ee3c in captured_command_loop (data=0x0) at
../../gdb-7.6/gdb/main.c:258
#28 0x0050ce7a in catch_errors (func=0x50ee27 <captured_command_loop>,
func_args=0x0, errstring=0x7a6a04 <__PRETTY_FUNCTION__.12659+138> "", mask=6)
at ../../gdb-7.6/gdb/exceptions.c:546
#29 0x00510060 in captured_main (data=0x1e7fe90) at
../../gdb-7.6/gdb/main.c:1041
#30 0x0050ce7a in catch_errors (func=0x50f087 <captured_main>,
func_args=0x1e7fe90, errstring=0x7a6a04 <__PRETTY_FUNCTION__.12659+138> "",
mask=6) at ../../gdb-7.6/gdb/exceptions.c:546
#31 0x00510096 in gdb_main (args=0x1e7fe90) at ../../gdb-7.6/gdb/main.c:1050
#32 0x004015b4 in main (argc=2, argv=0x2866710) at ../../gdb-7.6/gdb/gdb.c:34

-- 
You are receiving this mail because:
You are on the CC list for the bug.

      parent reply	other threads:[~2020-08-24 15:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 10:49 [Bug gdb/16016] New: " gdb.bugs at mfriebe dot de
2013-10-17 20:10 ` [Bug gdb/16016] " sergiodj at redhat dot com
2014-09-12 23:12 ` sergiodj at redhat dot com
2015-01-06  1:35 ` gdb.bugs at mfriebe dot de
2015-08-31 10:08 ` gdb.bugs at mfriebe dot de
2020-08-20 22:22 ` mnalis-sourceware at voyager dot hr
2020-08-21 20:31 ` [Bug pascal/16016] " tromey at sourceware dot org
2020-08-24 15:45 ` muller at sourceware dot org [this message]

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=bug-16016-4717-s6mVY8O9HP@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@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).