Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debuginfo: tweak the order of get_function_name_and_base and dladdr on FreeBSD #22547

Closed
wants to merge 1 commit into from

Conversation

iblislin
Copy link
Member

There is a known bug in FreeBSD's dladdr(3):
(Quote from manual dladdr(3))

    In dynamically linked programs,
    the address of a global function is considered to point to its
    program linkage table entry, rather than to the entry point of the
    function itself.  This causes most global functions to appear to be
    defined within the main executable, rather than in the shared
    libraries where the actual code resides.

Function get_function_name_and_base implemented in PR #22472 provides
a (slow but cross-platform) way to lookup function name and base address
via LLVM.

@yuyichao proposes that getting info from get_function_name_and_base
first and making original dladdr as fallback.

Fix: #20798
See also: #22472 (comment)


Once this issue get fixed, test-file will become the last blocker of FreeBSD CI. :)

…n FreeBSD

There is a known bug in FreeBSD's dladdr(3):
    (Quote from manual dladdr(3))
    In dynamically linked programs,
    the address of a global function is considered to point to its
    program linkage table entry, rather than to the entry point of the
    function itself.  This causes most global functions to appear to be
    defined within the main executable, rather than in the shared
    libraries where the actual code resides.

Function `get_function_name_and_base` implemented in PR JuliaLang#22472 provides
a (slow but cross-platform) way to lookup function name and base address
via LLVM.

@yuyichao propose that getting info from `get_function_name_and_base`
first and making original `dladdr` as fallback.

Fix: JuliaLang#20798
See also: JuliaLang#22472 (comment)
@yuyichao
Copy link
Contributor

That's not the issue. We are not hitting the dladdr bug afaict. I'll post a different version later.

P.S. don't mention people in the commit message. It'll create a notification everytime the commit is rebased.

@yuyichao yuyichao closed this Jun 26, 2017
@@ -734,7 +734,7 @@ static void get_function_name_and_base(const object::ObjectFile *object, bool in
saddr = nullptr;
// Try platform specific methods first since they are usually faster
if (saddr && !*saddr) {
#if defined(_OS_LINUX_) && !defined(JL_DISABLE_LIBUNWIND)
#if (defined(_OS_LINUX_) || defined(_OS_FREEBSD_)) && !defined(JL_DISABLE_LIBUNWIND)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that the answer to the question I asked in #20798 (comment)

see if the libunwind on FreeBSD support that too

is yes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just mean that the function does exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By observing it in gdb, the values from pip are fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just mean that the function does exist.

yes, it's available.

@iblislin iblislin deleted the fbsd-dladdr branch June 26, 2017 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stacktrace disappear on FreeBSD
2 participants