From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C7CB1386EC41; Mon, 24 Aug 2020 15:45:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7CB1386EC41 From: "muller at sourceware dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: pascal X-Bugzilla-Version: 7.6 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: muller at sourceware dot org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 15:45:58 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D16016 Pierre Muller changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |muller at sourceware dot o= rg --- Comment #6 from Pierre Muller --- Issue confirmed for gdb-7.6 also, the problem comes from a change of the=20 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=3D0x276e390, container_type=3D0x2792090, container_addr=3D4243472) 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 fir= st 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=20 pty TFOO=20 generates a different output after=20 p p1^ has been issued! Pierre Muller (gdb) p p1^ Hardware watchpoint 3: *$3 Old value =3D (struct cplus_struct_type *) 0x7b07c0 New value =3D (struct cplus_struct_type *) 0x2792500 allocate_cplus_struct_type (type=3D0x2792090) at ../../gdb-7.6/gdb/gdbtypes.c:1932 1932 *(TYPE_RAW_CPLUS_SPECIFIC (type)) =3D cplus_struct_default; top> bt #0 allocate_cplus_struct_type (type=3D0x2792090) at ../../gdb-7.6/gdb/gdbtypes.c:1932 #1 0x005fbae0 in gnuv3_dynamic_class (type=3D0x2792090) at ../../gdb-7.6/gdb/gnu-v3-abi.c:206 #2 0x005fbe0a in gnuv3_get_vtable (gdbarch=3D0x276e390, container_type=3D0x2792090, container_addr=3D4243472) at ../../gdb-7.6/gdb/gnu-v3-abi.c:249 #3 0x005fbf37 in gnuv3_rtti_type (value=3D0x2795f68, full_p=3D0x1e7f5e4, top_p=3D0x1e7f5e0, using_enc_p=3D0x1e7f5dc) at ../../gdb-7.6/gdb/gnu-v3-abi= .c:301 #4 0x005fdf21 in value_rtti_type (v=3D0x2795f68, full=3D0x1e7f5e4, top=3D0= x1e7f5e0, using_enc=3D0x1e7f5dc) at ../../gdb-7.6/gdb/cp-abi.c:120 #5 0x004c619c in value_full_object (argp=3D0x2795f68, rtype=3D0x0, xfull= =3D0, xtop=3D0, xusing_enc=3D0) at ../../gdb-7.6/gdb/valops.c:3604 #6 0x004b6e81 in readjust_indirect_value_type (value=3D0x2795f68, enc_type=3D0x2792090, original_type=3D0x2792148, original_value=3D0x4656798= ) at ../../gdb-7.6/gdb/value.c:3277 #7 0x004c28db in value_ind (arg1=3D0x4656798) at ../../gdb-7.6/gdb/valops.= c:1776 #8 0x004bda86 in evaluate_subexp_standard (expect_type=3D0x0, exp=3D0x279d= 7e0, pos=3D0x1e7f99c, noside=3DEVAL_NORMAL) at ../../gdb-7.6/gdb/eval.c:2550 #9 0x004b71ee in evaluate_subexp (expect_type=3D0x0, exp=3D0x279d7e0, pos=3D0x1e7f99c, noside=3DEVAL_NORMAL) at ../../gdb-7.6/gdb/eval.c:71 #10 0x004b736d in evaluate_expression (exp=3D0x279d7e0) at ../../gdb-7.6/gdb/eval.c:146 #11 0x004d10fa in print_command_1 (exp=3D0x2866f02 "p1^", voidprint=3D1) at ../../gdb-7.6/gdb/printcmd.c:965 #12 0x004d123f in print_command (exp=3D0x2866f02 "p1^", from_tty=3D1) at ../../gdb-7.6/gdb/printcmd.c:1006 #13 0x00449a90 in do_cfunc (c=3D0x2745890, args=3D0x2866f02 "p1^", from_tty= =3D1) at ../../gdb-7.6/gdb/cli/cli-decode.c:113 #14 0x0044c263 in cmd_func (cmd=3D0x2745890, args=3D0x2866f02 "p1^", from_t= ty=3D1) at ../../gdb-7.6/gdb/cli/cli-decode.c:1859 #15 0x005ebf00 in execute_command (p=3D0x2866f04 "^", from_tty=3D1) at ../../gdb-7.6/gdb/top.c:484 #16 0x00516a4b in command_handler (command=3D0x2866f00 "p p1^") at ../../gdb-7.6/gdb/event-top.c:431 #17 0x00516f47 in command_line_handler (rl=3D0x4587840 "") 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=3D0x0) at ../../gdb-7.6/gdb/event-top.c:163 #20 0x00516972 in stdin_event_handler (error=3D0, client_data=3D0x0) at ../../gdb-7.6/gdb/event-top.c:371 #21 0x00515bab in handle_file_event (data=3D...) 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=3D0x0) at ../../gdb-7.6/gdb/main.c:258 #28 0x0050ce7a in catch_errors (func=3D0x50ee27 , func_args=3D0x0, errstring=3D0x7a6a04 <__PRETTY_FUNCTION__.12659+138> "", m= ask=3D6) at ../../gdb-7.6/gdb/exceptions.c:546 #29 0x00510060 in captured_main (data=3D0x1e7fe90) at ../../gdb-7.6/gdb/main.c:1041 #30 0x0050ce7a in catch_errors (func=3D0x50f087 , func_args=3D0x1e7fe90, errstring=3D0x7a6a04 <__PRETTY_FUNCTION__.12659+138>= "", mask=3D6) at ../../gdb-7.6/gdb/exceptions.c:546 #31 0x00510096 in gdb_main (args=3D0x1e7fe90) at ../../gdb-7.6/gdb/main.c:1= 050 #32 0x004015b4 in main (argc=3D2, argv=3D0x2866710) at ../../gdb-7.6/gdb/gd= b.c:34 --=20 You are receiving this mail because: You are on the CC list for the bug.=