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

No sources for native libraries #119

Open
zakkak opened this issue Sep 3, 2020 · 1 comment
Open

No sources for native libraries #119

zakkak opened this issue Sep 3, 2020 · 1 comment

Comments

@zakkak
Copy link
Collaborator

zakkak commented Sep 3, 2020

Description

Mandrel ships with libjvm.a and liblibchelper.a but not their sources.
As a result gdb (as well as other tools) fail to show the source code.

How To Reproduce

native-image -g HelloWorld
gdb helloworld
(gdb) b determineCPUFeatures 
Breakpoint 1 at 0x6c12c0: file /usr/lib/gcc/x86_64-redhat-linux/8/include/cpuid.h, line 241.
(gdb) r
Starting program: /home/zakkak/code/graal/helloworld
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, determineCPUFeatures (features=0x7fffffffd328) at /home/jenkins/jenkins/workspace/mandrel-linux-build/mandrel/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c:121
121     /home/jenkins/jenkins/workspace/mandrel-linux-build/mandrel/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c: No such file or directory.

Additional context

In order to fix this we need to:

  1. Ship the sources along the binaries
  2. Find a way for gdb to detect the sources. Currently it's looking in the directory where the sources were built from:
readelf --debug-dump=info /opt/jvms/mandrel-java11-20.1.0.1.Final/lib/svm/clibraries/linux-amd64/libjvm.a| grep comp_dir
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x975): /home/jenkins/jenkins/workspace/mandrel-linux-build/mandrel/substratevm/mxbuild/linux-amd64/src/com.oracle.svm.native.jvm.posix/amd64
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x1bb): /home/jenkins/jenkins/workspace/mandrel-linux-build/mandrel/substratevm/mxbuild/linux-amd64/src/com.oracle.svm.native.jvm.posix/amd64
@jerboaa
Copy link
Collaborator

jerboaa commented Dec 7, 2021

This program is a simple reproducer which uses JvmFunc.cs JVM_ActiveProcessorCount from libjvm.a:

$ cat TestLibjvmaDebugInfo.java 
public class TestLibjvmaDebugInfo {
	public static void main(String[] args) {
		System.out.println("Active proc count: " + Runtime.getRuntime().availableProcessors());
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants