This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] [PATCH 2/2] Support note NT_FILE for locating files.


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
--- Begin Message ---
[<email.message.Message instance at 0x1539200>]

--- End Message ---

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]