From: Mark Wielaard <mark@klomp.org>
To: "Frank Ch. Eigler" <fche@redhat.com>
Cc: elfutils-devel@sourceware.org, amerey@redhat.com
Subject: Re: patch 2/2 debuginfod server etc.
Date: Mon, 18 Nov 2019 15:01:00 -0000 [thread overview]
Message-ID: <fcfdd1fd6628b68d2c5995acf769b19587107ff9.camel@klomp.org> (raw)
In-Reply-To: <20191115210047.GD15272@redhat.com>
Hi Frank,
On Fri, 2019-11-15 at 16:00 -0500, Frank Ch. Eigler wrote:
> > > + string popen_cmd = string("/usr/bin/rpm2cpio " +
> > > shell_escape(b_source0));
> >
> > Why the hardcoded path?
> > Could you check at startup if rpm2cpio is in the PATH?
>
> Hm, since this is run under popen(), so it'll do $PATH searching for
> us. Checking whether it is present at runtime ... hmmm ugh ... how
> about an autoconf test instead? The worst thing that happens with
> the
> current code is that on a non-rpm system, if it does find .rpm files,
> the code will print errors and otherwise ignore RPMs.
OK, I think how you did it on the branch, just remove the path, let the
shell find rpm2cpio, is fine for now.
> > > + // extract this file to a temporary file
> > > + char tmppath[PATH_MAX] = "/tmp/debuginfod.XXXXXX"; // XXX:
> > > $TMP_DIR etc.
> >
> > Some other code uses:
> > const char *tmpdir = getenv ("TMPDIR") ?: P_tmpdir;
> > static const char suffix[] = "/debuginfod.XXXXXX";
> > Also PATH_MAX?
>
> OK -- and yeah if we getenv() we might need PATH_MAX.
> Will try asprintf() here and the client instead.
It would be really nice if this code at least respected TMPDIR.
> > Also I prefer checking against NULL, it is slightly more obvious (0
> > returns often means success).
>
> ... the C++ tradition is 0 for null pointers, but if you insist...
No, if that is the C++ way then that is fine.
> > > + Dwarf_Off offset = 0;
> > > + Dwarf_Off old_offset;
> > > + size_t hsize;
> > > +
> > > + while (dwarf_nextcu (dbg, old_offset = offset, &offset, &hsize, NULL, NULL, NULL) == 0)
> >
> > These days I would prefer dwarf_get_units (). It is slightly higher
> > level and immediately gives you the cudie and unit_type.
>
> Will look into that later.
>
> > > + {
> > > + Dwarf_Die cudie_mem;
> > > + Dwarf_Die *cudie = dwarf_offdie (dbg, old_offset + hsize, &cudie_mem);
> > > +
> > > + if (cudie == NULL)
> > > + continue;
> > > + if (dwarf_tag (cudie) != DW_TAG_compile_unit)
> > > + continue;
> > > +
> > > + const char *cuname = dwarf_diename(cudie) ?: "unknown";
> > > +
> > > + Dwarf_Files *files;
> > > + size_t nfiles;
> > > + if (dwarf_getsrcfiles (cudie, &files, &nfiles) != 0)
> > > + continue;
> >
> > So you are really only interested in the file/line tables.
> > In that case you could also use dwarf_next_lines which iterates through
> > the debug line units directly, so you don't need to do the whole CU DIE
> > tree iteration yourself (and it handles CUless tables).
>
> Ditto.
I believe the code works as is, so it isn't urgent.
I just think it
would simplify things a bit.
> > > + string waldo;
> > > + if (hat[0] == '/') // absolute
> > > + waldo = (string (hat));
> > > + else // comp_dir relative
> > > + waldo = (string (comp_dir) + string("/") + string (hat));
> >
> > Do you have to think about/handle a comp_dir that ends with a / ?
> > Old debugedit truncated some strings by adding /// (to fill up the
> > spaces till the '\0'...) Yes, terrible :{
>
> It should just work(tm) if the debugger uses the documented convention
> and preserves those extra slashes (just as if it preserved ../ and
> such).
See also the other email/review. So, we always add an '/' between
comp_dir and the file. That should probably be explicitly documented
because I wouldn't be surprised if some code doesn't when comp_dir
already ends in a slash.
I just double checked that dwarf_getsrclines always (unconditionally)
adds a '/', so the use of dwarf_filesrc here does the right thing.
Thanks,
Mark
next prev parent reply other threads:[~2019-11-18 15:01 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 19:04 patch 0/2 debuginfod submission Frank Ch. Eigler
2019-10-28 19:06 ` patch 1/2 debuginfod client Frank Ch. Eigler
2019-10-28 19:09 ` patch 2/2 debuginfod server etc Frank Ch. Eigler
2019-11-04 21:48 ` patch 3/3 debuginfod client interruptability Frank Ch. Eigler
2019-11-07 9:07 ` patch 4 debuginfod: symlink following mode Frank Ch. Eigler
2019-11-07 9:08 ` patch 5 debuginfod: prometheus metrics Frank Ch. Eigler
2019-11-15 17:26 ` Mark Wielaard
2019-11-15 17:58 ` Frank Ch. Eigler
2019-11-18 16:20 ` Mark Wielaard
2019-11-18 16:48 ` Frank Ch. Eigler
2019-11-19 16:13 ` Mark Wielaard
2019-11-15 16:49 ` patch 4 debuginfod: symlink following mode Mark Wielaard
2019-11-15 18:31 ` Frank Ch. Eigler
2019-11-18 16:27 ` Mark Wielaard
2019-11-15 16:16 ` patch 3/3 debuginfod client interruptability Mark Wielaard
2019-11-15 17:03 ` Aaron Merey
2019-11-15 17:35 ` Mark Wielaard
2019-11-15 18:14 ` Pedro Alves
2019-11-17 23:44 ` Mark Wielaard
2019-11-18 2:50 ` Frank Ch. Eigler
2019-11-18 9:24 ` Pedro Alves
2019-11-19 12:58 ` Mark Wielaard
2019-11-13 17:22 ` patch 2/2 debuginfod server etc Mark Wielaard
2019-11-14 11:54 ` Frank Ch. Eigler
2019-11-16 1:31 ` Mark Wielaard
2019-11-13 23:19 ` Mark Wielaard
2019-11-14 12:30 ` Frank Ch. Eigler
2019-11-18 14:17 ` Mark Wielaard
2019-11-18 18:41 ` Frank Ch. Eigler
2019-11-19 15:41 ` Mark Wielaard
2019-11-19 16:13 ` Frank Ch. Eigler
2019-11-19 20:11 ` Mark Wielaard
2019-11-19 21:15 ` Frank Ch. Eigler
2019-11-20 11:53 ` Mark Wielaard
2019-11-20 12:29 ` Frank Ch. Eigler
2019-11-21 14:16 ` Mark Wielaard
2019-11-21 15:40 ` Mark Wielaard
2019-11-21 16:01 ` Frank Ch. Eigler
2019-11-21 15:58 ` Frank Ch. Eigler
2019-11-21 16:37 ` Mark Wielaard
2019-11-21 17:18 ` Frank Ch. Eigler
2019-11-21 20:42 ` Mark Wielaard
2019-11-22 12:08 ` Mark Wielaard
2019-11-14 20:45 ` Mark Wielaard
2019-11-15 11:03 ` Mark Wielaard
2019-11-15 21:00 ` Frank Ch. Eigler
2019-11-18 15:01 ` Mark Wielaard [this message]
2019-11-15 14:40 ` Mark Wielaard
2019-11-15 19:54 ` Frank Ch. Eigler
2019-11-18 15:31 ` Mark Wielaard
2019-11-18 15:49 ` Frank Ch. Eigler
2019-11-12 11:12 ` patch 1/2 debuginfod client Mark Wielaard
2019-11-12 15:14 ` Frank Ch. Eigler
2019-11-12 21:59 ` Mark Wielaard
2019-11-14 0:33 ` Frank Ch. Eigler
2019-11-15 21:33 ` Mark Wielaard
2019-11-12 21:25 ` Mark Wielaard
2019-11-13 23:25 ` Frank Ch. Eigler
2019-11-16 0:46 ` Mark Wielaard
2019-11-16 18:53 ` Frank Ch. Eigler
2019-11-18 17:17 ` Mark Wielaard
2019-11-18 20:33 ` Frank Ch. Eigler
2019-11-19 15:57 ` Mark Wielaard
2019-11-19 16:20 ` Frank Ch. Eigler
2019-11-19 20:16 ` Mark Wielaard
2019-11-19 21:22 ` Frank Ch. Eigler
2019-11-20 12:50 ` Mark Wielaard
2019-11-20 13:30 ` Frank Ch. Eigler
2019-11-21 14:02 ` Mark Wielaard
2019-11-13 13:57 ` Mark Wielaard
2019-11-14 11:24 ` Frank Ch. Eigler
2019-11-16 0:52 ` Mark Wielaard
2019-11-16 2:28 ` Frank Ch. Eigler
2019-10-30 11:04 ` patch 0/2 debuginfod submission Mark Wielaard
2019-10-30 13:40 ` Frank Ch. Eigler
2019-10-30 14:12 ` Mark Wielaard
2019-10-30 18:11 ` Frank Ch. Eigler
2019-10-31 11:18 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fcfdd1fd6628b68d2c5995acf769b19587107ff9.camel@klomp.org \
--to=mark@klomp.org \
--cc=amerey@redhat.com \
--cc=elfutils-devel@sourceware.org \
--cc=fche@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).