From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11632 invoked by alias); 14 Jan 2008 13:17:23 -0000 Received: (qmail 11625 invoked by uid 22791); 14 Jan 2008 13:17:22 -0000 X-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_44,J_CHICKENPOX_54,J_CHICKENPOX_56,J_CHICKENPOX_63,J_CHICKENPOX_75,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 14 Jan 2008 13:16:55 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m0EDGreU031701 for ; Mon, 14 Jan 2008 08:16:53 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0EDGqcf005714 for ; Mon, 14 Jan 2008 08:16:52 -0500 Received: from [172.16.57.153] (multics.rdu.redhat.com [172.16.57.153]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m0EDGqCr016277 for ; Mon, 14 Jan 2008 08:16:52 -0500 Subject: Re: [SCM] master: Add -sysroot option to fhpd. From: Stan Cox To: Frysk List In-Reply-To: <1200301565.3383.5.camel@dijkstra.wildebeest.org> References: <20080114051518.31275.qmail@sourceware.org> <1200301565.3383.5.camel@dijkstra.wildebeest.org> Content-Type: text/plain Date: Mon, 14 Jan 2008 13:17:00 -0000 Message-Id: <1200316510.16575.105.camel@multics.rdu.redhat.com> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2008-q1/txt/msg00020.txt.bz2 On Mon, 2008-01-14 at 10:06 +0100, Mark Wielaard wrote: > Hi Stan, > > On Mon, 2008-01-14 at 05:15 +0000, scox@sourceware.org wrote: > > commit c02d1bd3109ef0406be508fc08426e75b1b6fe07 > > Author: Stan Cox > > Date: Mon Jan 14 00:12:57 2008 -0500 > > > > Add -sysroot option to fhpd. > > > > * fhpd.java (main): Add sysroot option. > > * Makefile.am (frysk/pkglibdir/funit-addresses-stripped): New > > * DwflCache.java (getSysRoot): New > > * DbgVariables.java (DbgVariables): Make public. > > (vars): Make static final. Add SYSROOT. > > (getStringValue): Make static. Return String. > > * ListCommand.java (interpret): Consider SYSROOT. > > * TestSysRoot.java: New file. > > * Dwfl.java (Dwfl): Add sysroot parameter. Change all callers. > > [...] > > + public void testHaveSysRoot() { > > + File testPath = Config.getPkgLibFile("funit-addresses"); > > + System.out.println(Config.getBinFile("fhpd").getAbsolutePath() + > > + " -sysroot " + testPath.getParent() + "/test-sysroot/ " + > > + testPath.getParent() + "/test-sysroot/" > > + + testPath.getAbsolutePath()); > > + child = new Expect(new String[] { > > + Config.getBinFile("fhpd").getAbsolutePath(), > > + "-sysroot", testPath.getParent() + "/test-sysroot/", > > + testPath.getParent() + "/test-sysroot/" > > + + testPath.getAbsolutePath() > > + }); > > This test doesn't work for me (and note the System.out.println which > probably shouldn't be there). It gives the following output: > > $ ./TestRunner frysk.hpd.TestSysRoot > Running testHaveSysRoot(frysk.hpd.TestSysRoot) .../home/mark/src/frysk-obj/frysk-core/frysk/bindir/fhpd -sysroot /home/mark/src/frysk-obj/frysk-core/frysk/pkglibdir/test-sysroot/ /home/mark/src/frysk-obj/frysk-core/frysk/pkglibdir/test-sysroot//home/mark/src/frysk-obj/frysk-core/frysk/pkglibdir/funit-addresses > ERROR > frysk.expunit.EndOfFileException: end-of-file; expecting: <<\(fhpd\) >>; buffer < || fhpd || fhpd [] > > -console Set the log LOG to level LEVEL. Can set > multiple logs. The LEVEL can be [ OFF | > SEVERE | WARNING | INFO | CONFIG | FINE | > FINER | FINEST | ALL]. Example: -console > frysk=FINEST > -log Set the log LOG to level LEVEL. Can set > multiple logs. The LEVEL can be [ OFF | > SEVERE | WARNING | INFO | CONFIG | FINE | > FINER | FINEST | ALL]. Example -log > frysk=FINE > -verbose output verbose logging messages > -trace Set the logger LOG to level LEVEL. > The LEVEL can be [ NONE | FINE | FINEST ]. > Example -trace frysk=FINE > -noexe Do not attempt to read an executable for a > corefile > -s, -sysroot SysRoot-Path Assume the executable is from a sysroot > build > > Standard options: > -help print this help, then exit > -version print version number, then exit > > Exception in thread "main" java.lang.RuntimeException: command not readable: /home/mark/src/frysk-obj/frysk-core/frysk/pkglibdir/test-sysroot//home/mark/src/frysk-obj/frysk-core/frysk/pkglibdir/funit-addresses > at frysk.bindir.fhpd$1.parseCommand(fhpd) > at frysk.util.CommandlineParser.doParse(fhpd) > at frysk.util.CommandlineParser.parse(fhpd) > at frysk.bindir.fhpd.main(fhpd) > >> > > I assume you have something in your tree that generates > the /home/mark/src/frysk-obj/frysk-core/frysk/pkglibdir/test-sysroot/ > directory. But I couldn't figure out how to properly do that. > > Could you take a look? And maybe add some documentation on how a sysroot > dir should look like, how to generate one by hand? > > Thanks, > > Mark > That sysroot directory was supposed to be created but meanwhile can be created (and tested) via: frysk/pkglibdir/funit-addresses-stripped; ./TestRunner frysk.hpd.TestSysRoot That test is a little baroque. It relies on the build process to build a frysk-core/frysk/pkglibdir/test-sysroot directory, which simulates building with mock and installing via a sysroot. Then TestSysRoot tests finding the debug and source via testing with fhpd. What is currently there: Added -sysroot option to fhpd. This option sets the SYSROOT debug variable in DbgVariables.java. Finding the debuginfo in a sysroot is a little tricky. Given: /sys/root/dir/usr/bin/program and /sys/root/dir/usr/lib/debug/usr/bin/program.debug Elfutils can be given an absolute or relative path to look for program.debug. It will look in: 1. /sys/root/dir/usr/bin/program.debug 2. /sys/root/dir/usr/bin/a/relative/path/program.debug 3. /an/absolute/path/sys/root/dir/usr/bin/program.debug It will not look in /an/absolute/path/program.debug, otherwise it could be given /sys/root/dir/usr/lib/debug/usr/bin. Therefore DwflCache.java generates a relative path that has the same effect. ListCommand.java considers SYSROOT when looking for program.c. What is not there yet: The -sysroot option has not been added to fstack or other fhpd requests yet and -sysroot needs to be added to the documentation. The bare minimum was done to get DbgVariables.java to support accessing variable values not just by sysroot, but other uses as well. More extensive testing of sysroot needs to be done by TestSysRoot.java.