On Thu, 17 Nov 2011 20:01:42 +0000
Philip Ashmore <contact@philipashmore.com> wrote:
> On 17/11/11 14:56, Neil Williams wrote:
> > The path doesn't matter that much, as long as the debugger can find a
> > filename which at least matches the end of the path. i.e. work
> > backwards and use the best match. This isn't down to Debian, it is down
> > to how gcc and gdb work together and how developers need to use gdb or
> > other tools frontending gdb to set the path to the unpacked sources.
> > Some tools do it better than others, especially when considering how to
> > follow a call down through a couple of different libraries.
> >
> You mean as long as the user knows where the sources are supposed to be
> installed, such as
> /usr/src/foo-1.2/src/foo-widget.cpp
$ apt-get source
That puts the unpacked source exactly where the user expects - in the
current directory.
You'd need to be root to put the unpacked source into /usr/src using
apt-get source and that is NOT good advice.
There are binary packages which *install* the source into /usr/src but
that isn't the default. This is about getting the source of typical,
routine Qt applications and libraries. *That* is what you get from
deb-src URL's. Packages which unpack to /usr/src will come from deb
repositories NOT deb-src.
> , presuming they are even installed or the user downloaded (the matching
> version of) them.
apt-get source - it always gives you the matching version, that's the
point.
> The debugger will only find the file itself if the debugging information
> contains an absolute path.
Not true. The debugger will look for the path you provide and try to
match the files according to the reverse lookup - much the same way as
patch.
> The choice of root folder, for example /usr/src/foo-1.2 or
> /usr/src/{build-id}/foo-1.2
> is Debian specific.
More commonly, /home/$USER/code/src/$PACKAGE etc.
> The tools which Debian supplies should also use it so that the sources
> get installed there.
>
> Hopefully one day, the Debian build tools will alter the debugging
> information to point to this
> location regardless of where the sources really were when the package
> was built.
>
> Could this be a build option?
No, because the actual location varies according to user preference.
I use /home/neil/code/debian/src or /home/neil/code/debian/qa/
or /home/neil/code/debian/rc, depending on why I'm debugging a
particular package. ./src/ for routine devleopment, ./qa/ for orphaned
packages and ./rc/ for release goals. Depending on exactly what is
going on, I could quite easily be debugging three different versions of
the same package in those directories and if I need to debug a fourth,
well it's trivial.
> Also, if source packages from deb-src could be "installed", populating
> /usr/src then that would
> avoid having to package "source" binary packages, and be version-safe.
Forget about /usr/src, it isn't useful for the majority of packages.
Arbitrary directories specified by the user are the only way to allow
developers to debug against a variety of dependencies and in a variety
of situations. /usr/src is a privileged path, source does not need a
privileged path and is usually far better in a user path.
Qt applications or libraries do NOT use /usr/src.
--
Neil Williams
=============
http://www.linux.codehelp.co.uk/
Attachment:
pgp5izr5UW2gR.pgp
Description: PGP signature