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

gdb debugging of native images without setting the sources directory no longer works as of GraalVM/Mandrel 21.1 #20321

Closed
zakkak opened this issue Sep 22, 2021 · 1 comment · Fixed by #20355
Assignees
Labels
area/mandrel kind/bug Something isn't working
Milestone

Comments

@zakkak
Copy link
Contributor

zakkak commented Sep 22, 2021

Describe the bug

oracle/graal@dee66ca (included in GraalVM/Mandrel >=21.1) started enforcing the use of absolute paths in DW_AT_comp_dir. These paths are essentially pointing to the location of the "sources" directory holding the source code corresponding to the binary being debugged. In Quarkus we copy the "sources" directory after the compilation is done:

final String sources = "sources";
final Path generatedSources = outputDir.resolve(sources);
final Path finalSources = outputTargetBuildItem.getOutputDirectory().resolve(sources);
IoUtils.copy(generatedSources, finalSources);
IoUtils.recursiveDelete(generatedSources);

As a result the absolute paths written in the DW_AT_comp_dir entries become invalid and thus the user needs to invoke directory path/to/sources in gdb to let it know where to find the sources. This was optional prior to 21.1 as long as gdb was started from the same directory containing the sources directory. This last part made debugging on deployment environments a bit easier as well, since the user could copy the sources directory next to the binary and start gdb from there without any additional configuration.

Expected behavior

When running gdb in the target directory, it should be able to detect the sources without additional configuration.

Actual behavior

gdb requires using directory to point it to the sources directory.

How to Reproduce?

  1. Compile an application with -Dnative and -Dquarkus.native.debug.enabled=true
  2. Enter target directory and run gdb <my-app-runner>
  3. Run info func <part of a method name in the app> to get a method
  4. Try to list that method, e.g. list myMethod

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@zakkak zakkak added the kind/bug Something isn't working label Sep 22, 2021
@zakkak zakkak self-assigned this Sep 22, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 22, 2021

/cc @galderz

@zakkak zakkak changed the title gdb debugging of native images without setting the sources directory no longer works as of 21.2 gdb debugging of native images without setting the sources directory no longer works as of 21.1 Sep 22, 2021
@zakkak zakkak changed the title gdb debugging of native images without setting the sources directory no longer works as of 21.1 gdb debugging of native images without setting the sources directory no longer works as of GraalVM/Mandrel 21.1 Sep 22, 2021
@quarkus-bot quarkus-bot bot added this to the 2.4 - main milestone Sep 24, 2021
@geoand geoand modified the milestones: 2.4 - main, 2.3.0.Final Sep 28, 2021
@gsmet gsmet modified the milestones: 2.3.0.Final, 2.2.4.Final Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/mandrel kind/bug Something isn't working
Projects
None yet
3 participants