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, which is type in FreeBSD i386. The following patch checks for both relocation types SHT_REL and SHT_RELA, and calls matching update function.Tested usdt example program from (https://wiki.freebsd.org/DTrace/userland) in FreeBSD -10BETA1 - i386 and it works. -------------------------------------------------- --- dt_link.c 2013-12-15 14:24:37.000000000 +0400 +++ /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c 2013-12-15 14:22:21.000000000 +0400 @@ -1542,7 +1542,10 @@ rela.r_offset = 0; rela.r_info = 0; rela.r_addend = 0; - (void) gelf_update_rela(data_rel, i, &rela); + if (shdr_rel.sh_type == SHT_RELA) + (void) gelf_update_rela(data_rel, i, &rela); + else + (void) gelf_update_rel(data_rel, i, (GElf_Rel *)&rela); #endif mod = 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 Hi Prashanth, I've reproduced this on 10.0BETA4. It appears to be specific to i386; the same test works fine on amd64. 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. > # ./db > Bus error (core dumped) > > If run with dtrace > > # dtrace -s db.d -c ./db > dtrace: script 'db.d' matched 2 probes > CPU ID FUNCTION:NAME > 0 43245 main:query-start Query: SELECT * FROM apples > > the program hungs after printing the first probe. > > Had to use the following command > # env WITH_DTRACE=1 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>
