Date: Fri, 04 Aug 2017 12:46:18 +0200 From: Andreas Longwitz <longwitz@incore.de> To: Mark Johnston <markj@FreeBSD.org> Cc: "freebsd-dtrace@freebsd.org" <freebsd-dtrace@freebsd.org> Subject: Re: g_journal_read has broken argument list in V10 Message-ID: <5984507A.3090104@incore.de> In-Reply-To: <20170803171011.GB4968@wkstn-mjohnston.west.isilon.com> References: <596F2CDA.1000705@incore.de> <598343D8.8060101@incore.de> <20170803171011.GB4968@wkstn-mjohnston.west.isilon.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello, thanks for answer.
>>
>> The function g_journal_read() is the only one in g_journal.c that shows
>> the described problem. I can not decide, if the object module
>> g_journal.o is broken or if ctfconvert does something wrong.
>
> It's possible that the compiler is reordering arguments. CTF is
> generated from DWARF info, so the way to determine if this is the case
> is to inspect the dwarf tags with dwarfdump or readelf -w and check the
> parameter order there. I don't know why the arguments would be getting
> reordered in this case, but I've seen it happen before, particularly in
> functions that take struct values as parameters. Specifically, on amd64
> such parameters are moved to the end of the list so other parameters may
> be passed in registers.
>
> FWIW, with clang 5.0 on ~CURRENT I get the expected parameter order:
>
> [23] FUNC (g_journal_read) returns: 1 args: (1090, 988, 332, 332)
Yes, dwarfdump shows the problem is in g_journal.o, the list of formal
parameters is reordered by the compiler:
< 1><0x0000cb4f> DW_TAG_subprogram
DW_AT_name g_journal_read
DW_AT_decl_file 0x00000001
/usr/src/sys/geom/journal/g_journal.c
DW_AT_decl_line 0x0000061f
DW_AT_prototyped yes(1)
DW_AT_low_pc 0x00008ad0
DW_AT_high_pc 0x0000915c
DW_AT_frame_base DW_OP_reg6
< 2><0x0000cb6a> DW_TAG_formal_parameter
DW_AT_name sc
DW_AT_decl_file 0x00000001
/usr/src/sys/geom/journal/g_journal.c
DW_AT_decl_line 0x0000061f
DW_AT_type <0x0000949a>
DW_AT_location <loclist at offset
0x00005c35 with 2 entries follows>
[ 0]< offset pair low-off : 0x00008ad0 addr
0x00008ad0 high-off 0x00008b35 addr 0x00008b35>DW_OP_reg5
[ 1]< offset pair low-off : 0x00008b35 addr
0x00008b35 high-off 0x00008b35 addr 0x00008b35>DW_OP_breg6-104
< 2><0x0000cb7a> DW_TAG_formal_parameter
DW_AT_name ostart
DW_AT_decl_file 0x00000001
/usr/src/sys/geom/journal/g_journal.c
DW_AT_decl_line 0x0000061f
DW_AT_type <0x00003b31>
DW_AT_location <loclist at offset
0x00005cb5 with 1 entries follows>
[ 0]< offset pair low-off : 0x00008ad0 addr
0x00008ad0 high-off 0x00008bb8 addr 0x00008bb8>DW_OP_reg14
< 2><0x0000cb8a> DW_TAG_formal_parameter
DW_AT_name oend
DW_AT_decl_file 0x00000001
/usr/src/sys/geom/journal/g_journal.c
DW_AT_decl_line 0x00000620
DW_AT_type <0x00003b31>
DW_AT_location <loclist at offset
0x00005c12 with 1 entries follows>
[ 0]< offset pair low-off : 0x00008ad0 addr
0x00008ad0 high-off 0x00008b35 addr 0x00008b35>DW_OP_reg2
< 2><0x0000cb9a> DW_TAG_formal_parameter
DW_AT_name pbp
DW_AT_decl_file 0x00000001
/usr/src/sys/geom/journal/g_journal.c
DW_AT_decl_line 0x0000061f
DW_AT_type <0x00005de4>
By the way, the following patch solves the problem with the wrong
argument counts in ctfdump:
--- dump.c.1st 2015-07-03 16:39:24.000000000 +0200
+++ dump.c 2017-08-04 10:56:21.563805000 +0200
@@ -364,7 +364,8 @@
(void) printf(" [%lu] FUNC ", id);
if (name != NULL)
(void) printf("(%s) ", name);
- (void) printf("returns: %u args: (", *fp++);
+ (void) printf("returns: %u args: (", n);
+ fp++;
if (n != 0) {
(void) printf("%u", *fp++);
--
Andreas Longwitz
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5984507A.3090104>
