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

Offer quarkus property to enable debug symbols #9792

Closed
emmanuelbernard opened this issue Jun 4, 2020 · 21 comments · Fixed by #10093
Closed

Offer quarkus property to enable debug symbols #9792

emmanuelbernard opened this issue Jun 4, 2020 · 21 comments · Fixed by #10093
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@emmanuelbernard
Copy link
Member

Now that GraalVM has debug symbols, have a Quarkus property

e.g. quarkus.native.debug-symbols

so it generates the image with debug symbols.

Useful in conjunction with profiles

@emmanuelbernard emmanuelbernard added the kind/enhancement New feature or request label Jun 4, 2020
@emmanuelbernard
Copy link
Member Author

Hey @galderz or @dmlloyd , would you have time for this one ?

@galderz
Copy link
Member

galderz commented Jun 9, 2020

@emmanuelbernard sure assign it to me, but there's some obstacles to resolve before then.

I started playing with debug symbols and Quarkus a few days back, which led me to finding #9750.

Once that was fixed I tried to debug it with gdb 7.6, but gdb threw a segmentation fault. I tried with latest gdb 9.2 and at least that loaded the image with symbols, but I've not tried to step through the code yet to see if I can move between lines/code...etc.

Assuming that works fine, the tricky thing is access to sources. Some source zip files seem to be missing which @adinn spotted oracle/graal#2551. In my local testing I was just linking to locally built src zip files.

Once all of that is figure out we can wrap it up with the addition of the property.

Finally, @n1hility has requested for symbols to be kept in a separate file. That's not the case at the moment; symbols are kept in the same file as the binary. I'm checking to see how much would would that involve, how we're tracking that...etc.

@emmanuelbernard
Copy link
Member Author

OK, considering we would really like to get this one in 1.6, I propose we can add the high level Quarkus property to wire things all the way down. Whether GraalVM feature has bugs (or Quarkus has bugs) and whether we can move the symbols to a separate file, we should do as follow up tasks.

@gsmet
Copy link
Member

gsmet commented Jun 11, 2020

Ah, yes, I will send the email right away.

@gsmet
Copy link
Member

gsmet commented Jun 11, 2020

I created the wiki page the other day but forgot to send the email: https://github.com/quarkusio/quarkus/wiki/Release-Planning

@gsmet
Copy link
Member

gsmet commented Jun 11, 2020

Done.

@galderz galderz self-assigned this Jun 15, 2020
@galderz
Copy link
Member

galderz commented Jun 15, 2020

@emmanuelbernard Assigned this to me, I've started work on it.

@galderz
Copy link
Member

galderz commented Jun 15, 2020

@emmanuelbernard I've been chatting to @jerboaa and I'm thinking that -Dquarkus.native.debug-symbols might better be an enum rather than a boolean, because we plan to support debug symbols being stored inside the binary (e.g. internal) and debug symbols stored outside the binary (e.g. external). Would we change the property name then?

@galderz
Copy link
Member

galderz commented Jun 15, 2020

@emmanuelbernard Might be better if we discuss it in quarkus-dev google group?

@galderz
Copy link
Member

galderz commented Jun 16, 2020

Started a discussion on quarkus-dev about the configuration to expose. I will work with @jerboaa to see where we end up splitting symbols.

galderz added a commit to galderz/quarkus that referenced this issue Jun 16, 2020
galderz added a commit to galderz/quarkus that referenced this issue Jun 16, 2020
@emmanuelbernard
Copy link
Member Author

yes I think the enum is fine. I had the same thoughts when talking with Andrew during Insights.

@emmanuelbernard
Copy link
Member Author

What would be the values though?

@emmanuelbernard
Copy link
Member Author

Also we need to make room for the ability to generate "more" debug symbols.

Is this external file supposed to be configurable in name and location?
I have two proposals depending on this

Proposition 1: not configurable or with sensible default file name value

quarkus.native.debug-symbols.enable=NONE|INTERNAL|EXTERNAL
quarkus.native.debug-symbols.external-file=c:\Users\Emmanuel\Quarkus\debug.symbols
quarkus.native.debug-symbols.level=moderate|goestoeleven

Proposition 2: must define a file name anyways

quarkus.native.debug-symbols.enable=true
# absence of external file means internal
quarkus.native.debug-symbols.external-file=c:\Users\Emmanuel\Quarkus|debug.symbols
quarkus.native.debug-symbols.level=moderate|goestoeleven

@emmanuelbernard
Copy link
Member Author

emmanuelbernard commented Jun 16, 2020

I think 1 has my preference as sensible external file name might make a lot of sense.

@geoand
Copy link
Contributor

geoand commented Jun 16, 2020

I would go with 1

@rsvoboda
Copy link
Member

Regarding quarkus.native.debug-symbols.enable=NONE|INTERNAL|EXTERNAL

  • .enable evokes true/false being the value
  • I always struggle between.enable and .enabled suffix, which one is the one

I would go with with quarkus.native.debug-symbols=NONE|INTERNAL|EXTERNAL (drop .enable) or quarkus.native.debug-symbols.mode=NONE|INTERNAL|EXTERNAL (.enable => .mode)

@jerboaa
Copy link
Contributor

jerboaa commented Jun 16, 2020

@emmanuelbernard I'd like to avoid adding too many config values for this. OK for making the suffix configurable (defaulting to debug, say). The name of the external debug symbols would always be <binary>.<suffix>. Example foo, the binary, and foo.debug containing the debug symbols of binary foo with suffix debug (the default).

galderz added a commit to galderz/quarkus that referenced this issue Jun 16, 2020
@galderz
Copy link
Member

galderz commented Jun 16, 2020

@emmanuelbernard I opened a quarkus-dev discussion, but anyway...

I agree with @rsvoboda, something that has enable in it seems like it should be true|false.

Also, note that quarkus.native.debug-symbols already exists today, as a boolean, that adds -g (enterprise edition flag). Would we deprecate that? Or we could just reuse it as is (boolean)? Or remove it?

I'd just for an enum (that allows us to introduce new options in the future, including different levels).

Then, about the debug symbols external file, I'd just leave that out for now. If there's an option to set the path of the native binary, then one could modify that and get the symbols location modified along (so that it sits next to it).

@maxandersen
Copy link
Member

debug-symbols is a weird implementation detail for me.

should it not just to include debug info or not ? i.e. -g on javac and gcc compiler?.

@maxandersen
Copy link
Member

for me what would make sense is that the debug file location default to .symbols and then have a quarkus.native.debug=<list of options where none means don't do it>.

have it default on and then you just need to do -Dquarkus.native.debug=none to turn it off.

If you want to tweak settings do -Dquarkus.native.debug=lines,goto11 or if it truly just is a integer level tehn:

-Dquarkus.native.debug.enabled=false to turn off and -Dquarkus.native.debug.level=11

@galderz
Copy link
Member

galderz commented Jun 16, 2020

All, further discussions in https://groups.google.com/forum/#!topic/quarkus-dev/VOSQ6zhy_vI

galderz added a commit to galderz/quarkus that referenced this issue Jun 18, 2020
* Added new debug symbol enable option,
to avoid breaking existing usage.
* Used objcopy to split debug symbols from binary.
galderz added a commit to galderz/quarkus that referenced this issue Jun 18, 2020
* Added new debug symbol enable option,
to avoid breaking existing usage.
* Used objcopy to split debug symbols from binary.
galderz added a commit to galderz/quarkus that referenced this issue Jun 18, 2020
galderz added a commit to galderz/quarkus that referenced this issue Jun 22, 2020
galderz added a commit to galderz/quarkus that referenced this issue Jun 26, 2020
gsmet pushed a commit to galderz/quarkus that referenced this issue Jun 30, 2020
gsmet pushed a commit to galderz/quarkus that referenced this issue Jun 30, 2020
galderz added a commit to galderz/quarkus that referenced this issue Jun 30, 2020
…o#9792

* To avoid side-effects when building debug symbol source cache.
gsmet added a commit that referenced this issue Jul 1, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 1, 2020
* Added new debug symbol enable option,
to avoid breaking existing usage.
* Used objcopy to split debug symbols from binary.
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 1, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jul 1, 2020
@gsmet gsmet added this to the 1.6.0.Final milestone Jul 2, 2020
galderz added a commit to galderz/quarkus that referenced this issue Jul 7, 2020
galderz added a commit to galderz/quarkus that referenced this issue Aug 5, 2020
galderz added a commit to galderz/quarkus that referenced this issue Aug 5, 2020
…9792

* Also, check src/main/java exists
before adding it to the source search path.
galderz added a commit to galderz/quarkus that referenced this issue Aug 5, 2020
galderz added a commit to galderz/quarkus that referenced this issue Aug 5, 2020
galderz added a commit to galderz/quarkus that referenced this issue Aug 5, 2020
galderz added a commit to galderz/quarkus that referenced this issue Aug 6, 2020
* Add third party source jars support.
* Third party jars not downloaded by default,
so it requires user to call `mvn dependencies:sources`
or equivalent.
* If source jars are found,
they're put next to the jars in the lib directory.
* After generating native executable,
the source jars are removed.
* Application sources are added individually using
-H:DebugInfoSourceSearchPath option.
They're only added if the directory exists.
* Debug symbols flag switched
from -H:GenerateDebugInfo=1 to `-g`.
* Sources cache has been moved to target/sources-cache
using the -H:DebugInfoSourceCacheRoot option.
This makes sources cache more closely available.
gdb should discover these automatically,
but it does not seem to work,
so better use `set directories` pointing to them.
* These changes only work on Mandrel or GraalVM 20.2,
so reworked the whole GraalVM version and distribution
resolution logic to make this easier to handle.
* Previous ad-hoc GraalVM version resolution
has been been replaced by a regex solution.
* Added unit tests to verify that
GraalVM versions and distributions are resolved correctly
with a diverse set of `native-image --version` outputs.
galderz added a commit to galderz/quarkus that referenced this issue Aug 6, 2020
* Add third party source jars support.
* Third party jars not downloaded by default,
so it requires user to call `mvn dependencies:sources`
or equivalent.
* If source jars are found,
they're put next to the jars in the lib directory.
* After generating native executable,
the source jars are removed.
* Application sources are added individually using
-H:DebugInfoSourceSearchPath option.
They're only added if the directory exists.
* Debug symbols flag switched
from -H:GenerateDebugInfo=1 to `-g`.
* Sources cache has been moved to target/sources-cache
using the -H:DebugInfoSourceCacheRoot option.
This makes sources cache more closely available.
gdb should discover these automatically,
but it does not seem to work,
so better use `set directories` pointing to them.
* These changes only work on Mandrel or GraalVM 20.2,
so reworked the whole GraalVM version and distribution
resolution logic to make this easier to handle.
* Previous ad-hoc GraalVM version resolution
has been been replaced by a regex solution.
* Added unit tests to verify that
GraalVM versions and distributions are resolved correctly
with a diverse set of `native-image --version` outputs.
galderz added a commit to galderz/quarkus that referenced this issue Aug 6, 2020
* Add third party source jars support.
* Third party jars not downloaded by default,
so it requires user to call `mvn dependencies:sources`
or equivalent.
* If source jars are found,
they're put next to the jars in the lib directory.
* After generating native executable,
the source jars are removed.
* Application sources are added individually using
-H:DebugInfoSourceSearchPath option.
They're only added if the directory exists.
* Debug symbols flag switched
from -H:GenerateDebugInfo=1 to `-g`.
* Sources cache has been moved to target/sources-cache
using the -H:DebugInfoSourceCacheRoot option.
This makes sources cache more closely available.
gdb should discover these automatically,
but it does not seem to work,
so better use `set directories` pointing to them.
* These changes only work on Mandrel or GraalVM 20.2,
so reworked the whole GraalVM version and distribution
resolution logic to make this easier to handle.
* Previous ad-hoc GraalVM version resolution
has been been replaced by a regex solution.
* Added unit tests to verify that
GraalVM versions and distributions are resolved correctly
with a diverse set of `native-image --version` outputs.
gsmet pushed a commit to galderz/quarkus that referenced this issue Aug 6, 2020
* Add third party source jars support.
* Third party jars not downloaded by default,
so it requires user to call `mvn dependencies:sources`
or equivalent.
* If source jars are found,
they're put next to the jars in the lib directory.
* After generating native executable,
the source jars are removed.
* Application sources are added individually using
-H:DebugInfoSourceSearchPath option.
They're only added if the directory exists.
* Debug symbols flag switched
from -H:GenerateDebugInfo=1 to `-g`.
* Sources cache has been moved to target/sources-cache
using the -H:DebugInfoSourceCacheRoot option.
This makes sources cache more closely available.
gdb should discover these automatically,
but it does not seem to work,
so better use `set directories` pointing to them.
* These changes only work on Mandrel or GraalVM 20.2,
so reworked the whole GraalVM version and distribution
resolution logic to make this easier to handle.
* Previous ad-hoc GraalVM version resolution
has been been replaced by a regex solution.
* Added unit tests to verify that
GraalVM versions and distributions are resolved correctly
with a diverse set of `native-image --version` outputs.
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 6, 2020
* Add third party source jars support.
* Third party jars not downloaded by default,
so it requires user to call `mvn dependencies:sources`
or equivalent.
* If source jars are found,
they're put next to the jars in the lib directory.
* After generating native executable,
the source jars are removed.
* Application sources are added individually using
-H:DebugInfoSourceSearchPath option.
They're only added if the directory exists.
* Debug symbols flag switched
from -H:GenerateDebugInfo=1 to `-g`.
* Sources cache has been moved to target/sources-cache
using the -H:DebugInfoSourceCacheRoot option.
This makes sources cache more closely available.
gdb should discover these automatically,
but it does not seem to work,
so better use `set directories` pointing to them.
* These changes only work on Mandrel or GraalVM 20.2,
so reworked the whole GraalVM version and distribution
resolution logic to make this easier to handle.
* Previous ad-hoc GraalVM version resolution
has been been replaced by a regex solution.
* Added unit tests to verify that
GraalVM versions and distributions are resolved correctly
with a diverse set of `native-image --version` outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants