public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* dwfl_addrmodule() differences bw F20 and RHEL7
@ 2014-10-25  1:33 Sukadev Bhattiprolu
  0 siblings, 0 replies; 2+ messages in thread
From: Sukadev Bhattiprolu @ 2014-10-25  1:33 UTC (permalink / raw)
  To: elfutils-devel

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


We have some code in the perf tool[1] that uses following
sequence of calls to try and determine if the return address
for a function is in the link register (LR) or on the stack:

	dwfl = dwfl_begin(&offline_callbacks);

	dwfl_report_offline(dwfl, "" exec_file, -1);

	mod = dwfl_addrmodule(dwfl, pc);

	dwfl_module_eh_cfi(mod, &bias);

	/* etc.. */

where: exec_file is

	/usr/lib64/power8/libc-2.17.so (on RHEL7)
	/usr/lib64/libc-2.18.so (on Fedora20)

and 'pc' is an address in libc, say in vfprintf(), rand() etc.

This sequence of calls works consistently on Fedora20 and fails
consistently on RHEL7 - where dwfl_addrmodule() returns -1
(dwfl_errmsg() says "no error").

The versions of elfutils, glibc, gcc are slightly different
between the two and I have listed them below [2][3][4].

Is there a difference in the way libc or debug info is
organized between F20 and RHEL7 ?

The Fedora20 is a Power7 system and RHEL7 is a Power8.

With some debug statements, I see that in dwfl_addrsegment():

	lookup() retruns 1,
	dwfl->lookup_module is non-null
	dwfl_addrsegment() returns -1.

I can collect more debug if necessary. 

Appreciate any help in understanding what is going on.

Sukadev

[1] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/tools/perf/arch/powerpc/util/skip-callchain-idx.c

[2] elfutils RPMS that I have on my systems:

	Fedora20:
		elfutils-libelf-devel-0.158-1.fc20.ppc64
		elfutils-0.158-1.fc20.ppc64
		elfutils-libs-0.158-1.fc20.ppc64
		elfutils-libelf-0.158-1.fc20.ppc64
		elfutils-devel-0.158-1.fc20.ppc64

	RHEL7:
		elfutils-0.158-3.el7.ppc64
		elfutils-libelf-0.158-3.el7.ppc64
		elfutils-libs-0.158-3.el7.ppc64
		elfutils-libelf-devel-0.158-3.el7.ppc64
		elfutils-devel-0.158-3.el7.ppc64

[3] glibc RPMS on my systems:

	Fedora20:
		glibc-common-2.18-11.fc20.ppc64p7
		glibc-2.18-11.fc20.ppc64p7
		glibc-headers-2.18-11.fc20.ppc64p7
		glibc-debuginfo-common-2.18-11.fc20.ppc64p7
		glibc-devel-2.18-11.fc20.ppc64p7
		glibc-debuginfo-2.18-11.fc20.ppc64p7

	RHEL7:
		glibc-common-2.17-55.el7.ppc64
		glibc-headers-2.17-55.el7.ppc64
		glibc-debuginfo-2.17-55.el7.ppc64
		glibc-2.17-55.el7.ppc64
		glibc-devel-2.17-55.el7.ppc64
		glibc-debuginfo-common-2.17-55.el7.ppc64

[4] gcc RPMS

	Fedora20:
		libgcc-4.8.2-7.fc20.ppc64
		gcc-4.8.2-7.fc20.ppc64
		gcc-c++-4.8.2-7.fc20.ppc64
	RHEL7:
		gcc-4.8.2-16.el7.ppc64
		gcc-c++-4.8.2-16.el7.ppc64
		libgcc-4.8.2-16.el7.ppc64
		gcc-gfortran-4.8.2-16.el7.ppc64


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: dwfl_addrmodule() differences bw F20 and RHEL7
@ 2014-10-30  9:25 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-10-30  9:25 UTC (permalink / raw)
  To: elfutils-devel

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

On Fri, 2014-10-24 at 18:33 -0700, Sukadev Bhattiprolu wrote:
> We have some code in the perf tool[1] that uses following
> sequence of calls to try and determine if the return address
> for a function is in the link register (LR) or on the stack:
> 
> 	dwfl = dwfl_begin(&offline_callbacks);
> 
> 	dwfl_report_offline(dwfl, "" exec_file, -1);
> 
> 	mod = dwfl_addrmodule(dwfl, pc);
> 
> 	dwfl_module_eh_cfi(mod, &bias);
> 
> 	/* etc.. */
> 
> where: exec_file is
> 
> 	/usr/lib64/power8/libc-2.17.so (on RHEL7)
> 	/usr/lib64/libc-2.18.so (on Fedora20)
> 
> and 'pc' is an address in libc, say in vfprintf(), rand() etc.
> 
> This sequence of calls works consistently on Fedora20 and fails
> consistently on RHEL7 - where dwfl_addrmodule() returns -1
> (dwfl_errmsg() says "no error").

That should only happen when dwfl == NULL (in which case there should be
an earlier error), or no module contains the given address.

> The versions of elfutils, glibc, gcc are slightly different
> between the two and I have listed them below [2][3][4].
> 
> Is there a difference in the way libc or debug info is
> organized between F20 and RHEL7 ?

I don't believe so. But clearly these are two completely different glibc
versions.

> The Fedora20 is a Power7 system and RHEL7 is a Power8.
> 
> With some debug statements, I see that in dwfl_addrsegment():
> 
> 	lookup() retruns 1,
> 	dwfl->lookup_module is non-null
> 	dwfl_addrsegment() returns -1.
> 
> I can collect more debug if necessary. 

Could you find out what the module load address is for the Dwfl_Module
you create through dwfl_report_offline? dwfl_module_info will give you
the start and end address range. And what is the pc value you provide to
dwfl_addrmodule in both cases?

Thanks,

Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-30  9:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-25  1:33 dwfl_addrmodule() differences bw F20 and RHEL7 Sukadev Bhattiprolu
2014-10-30  9:25 Mark Wielaard

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