public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [commit] [PATCH 2/2] Support note NT_FILE for locating files.
@ 2014-09-26 20:45 Jan Kratochvil
  0 siblings, 0 replies; only message in thread
From: Jan Kratochvil @ 2014-09-26 20:45 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 2839 bytes --]

On Tue, 23 Sep 2014 16:04:58 +0200, Mark Wielaard wrote:
> On Tue, 2014-09-09 at 23:00 +0200, Jan Kratochvil wrote:
> > tests/test-core.core.bz2 had to have its NT_FILE disabled as run-unstrip-n.sh
> > otherwise FAILs:
> > FAIL: 0x7f67f2aaf000+0x202000 - . - /home/jkratoch/redhat/elfutils-libregr/test-core-lib.so
> > PASS: 0x7f67f2aaf000+0x202000 - . - test-core-lib.so
> > As test-core-lib.so is found in link_map but it is not present on the disk
> > elfutils now chooses the more reliable filename from NT_FILE (although that
> > filename is also not found on the disk).  Updating the expected text would be
> > also sufficient.
> 
> I think it is better to just change the expected text instead of
> updating the binary core file.

Done.  Just the testcase now unsuccessfully does:
	open("/home/jkratoch/redhat/elfutils-libregr/test-core-lib.so", O_RDONLY) = -1 ENOENT (No such file or directory)
and it may have some unexpected result if such file exists (sure unlikely).


> > +/* Return whether there is SZ bytes available at PTR till END.
> > +   Function comes from src/readelf.c .  */
> 
> function is small enough that comment where it came from is not really
> necessary.

Done.


> Just pass in the ei_data byte since that is all you are using.

Done.


> Same here. Just pass in the ei_class (or ptrsize) and ei_data or a
> pointer to the e_ident and use that.

Done.


> > +testrun ${abs_top_builddir}/src/stack --core=linkmap-cut.core -e linkmap-cut >bt || true
> > +cat bt
> > +grep -qw libfunc bt
> > +grep -qw main bt
> 
> Maybe you want to use -m to check it got the module name correct?

OK, used that and updated the match:
	grep -q '^#0  0x00007f08bc24d681 libfunc - .////////////////////////////////////linkmap-cut-lib\.so$' bt
	grep -q '^#1  0x00000000004006b4 main - linkmap-cut$' bt


> The NT_FILE notes seem to have lots of slashed in them, is that
> deliberate?

There is always absolute filename from Linux kernel.  That would never work for
a testcase, therefore I had to patch the bytes by hexedit from absolute
pathname to a relative one:
      7f08bc24d000-7f08bc24e000 00000000 4096        /home/jkratoch/redhat/elfutils/tests/linkmap-cut-lib.so
->
      7f08bc24d000-7f08bc24e000 00000000 4096        .////////////////////////////////////linkmap-cut-lib.so


> The comments don't say how the binaries were generated,
> please add that in case someone wants to regenerate them one day.

I agree, added:
	# The core file has patched:
	# * _r_debug.r_map.l_next.l_next (vma 0x3fdf621718, offset 0x7718) = NULL,
	#   therefore all libraries after the main executable and vDSO are removed.
	# * NT_FILE absolute filenames are relativized to: ./////basename


Checked in:
	6d48bbf406851b56920582b8ce29db13ad4f4e2e


Thanks,
Jan

[-- Attachment #2: attachment.mht --]
[-- Type: message/rfc822, Size: 47 bytes --]


WzxlbWFpbC5tZXNzYWdlLk1lc3NhZ2UgaW5zdGFuY2UgYXQgMHgxNTM5MjAwPl0=

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-09-26 20:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 20:45 [commit] [PATCH 2/2] Support note NT_FILE for locating files Jan Kratochvil

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).