Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Dec 2013 19:30:19 +0800 (SGT)
From:      Prashanth Kumar <pra_udupi@yahoo.co.in>
To:        Michael Harsch <michaelharsch@hotmail.com>
Cc:        freebsd-dtrace@freebsd.org
Subject:   Please review:  dtrace usdt
Message-ID:  <1387107019.65592.YahooMailBasic@web192601.mail.sg3.yahoo.com>
In-Reply-To: <CAHfNqiDmAFPF%2BafzQfTfwTQn7M8g8RxrHNd9BcLWV0_ko19GNw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Dtrace doesn't properly process object file of relocation type SHT_REL, whi=
ch is type
in FreeBSD i386. The following patch checks for both relocation types SHT_R=
EL and SHT_RELA, and
calls matching update function.Tested usdt example program from (https://wi=
ki.freebsd.org/DTrace/userland)
in FreeBSD -10BETA1 - i386 and it works.
--------------------------------------------------
--- dt_link.c=092013-12-15 14:24:37.000000000 +0400
+++ /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c=092013=
-12-15 14:22:21.000000000 +0400
@@ -1542,7 +1542,10 @@
 =09=09=09rela.r_offset =3D 0;
 =09=09=09rela.r_info  =3D 0;
 =09=09=09rela.r_addend =3D 0;
-=09=09=09(void) gelf_update_rela(data_rel, i, &rela);
+=09=09=09if (shdr_rel.sh_type =3D=3D SHT_RELA)
+=09=09=09=09(void) gelf_update_rela(data_rel, i, &rela);
+=09=09=09else=20
+=09=09=09=09(void) gelf_update_rel(data_rel, i, (GElf_Rel *)&rela);
 #endif
=20
 =09=09=09mod =3D 1;
-----------------------------------------------------------

prashanth
--------------------------------------------
On Wed, 4/12/13, Michael Harsch <michaelharsch@hotmail.com> wrote:

 Subject: Re: dtrace usdt
 To: "Prashanth Kumar" <pra_udupi@yahoo.co.in>
 Cc: freebsd-dtrace@freebsd.org
 Date: Wednesday, 4 December, 2013, 11:13 PM
=20
 Hi Prashanth,
=20
 I've reproduced this on 10.0BETA4.=A0 It appears to be
 specific to i386;
 the same test works fine on amd64.
=20
 On Wed, Dec 4, 2013 at 3:29 AM, Prashanth Kumar <pra_udupi@yahoo.co.in>
 wrote:
 > Hi
 > Tried running the dtrace usdt example code from freebsd
 dtrace userland wiki page.
 > (https://wiki.freebsd.org/DTrace/userland).
 >
 > If run standalone the program segfaults.
 >=A0 # ./db
 > Bus error (core dumped)
 >
 > If run with dtrace
 >
 >=A0=A0=A0# dtrace -s db.d -c ./db
 > dtrace: script 'db.d' matched 2 probes
 > CPU=A0 =A0=A0=A0ID=A0 =A0 =A0
 =A0 =A0 =A0 =A0 =A0 =A0 =A0
 FUNCTION:NAME
 >=A0=A0=A00=A0 43245=A0 =A0 =A0
 =A0 =A0 =A0 =A0
 =A0=A0=A0main:query-start Query: SELECT * FROM
 apples
 >
 > the program hungs after printing the first probe.
 >
 > Had to use the following command
 >=A0=A0=A0# env WITH_DTRACE=3D1 make
 >
 > to build the program. Is there any other steps that i
 have missed to make the program work?.
 > This was tested on FreeBSD 10BETA1 - i386.
 >
 > regards
 > Prashanth
 > _______________________________________________
 > freebsd-dtrace@freebsd.org
 mailing list
 > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace
 > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org=
"
 >
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1387107019.65592.YahooMailBasic>