You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference-manual/native-image/DebugInfo.md
+12-5
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ line flag to the `native-image` command
28
28
native-image -g -H:+SourceLevelDebug Hello
29
29
```
30
30
31
-
Enabling debuginfo with flag `-H:GenerateDebugInfo=1` does not make any difference to how a generated
31
+
Enabling debuginfo with flag `-g` does not make any difference to how a generated
32
32
native image is compiled and does not affect how fast it executes nor how much memory it uses at runtime.
33
33
However, it can significantly increase the size of the generated image on disk. Enabling full parameter
34
34
and local variable information by passing flag `-H:+SourceLevelDebug` can cause a program to be compiled
@@ -38,7 +38,7 @@ slightly differently and for some applications this can slow down execution.
38
38
39
39
## Source File Caching
40
40
41
-
The `GenerateDebugInfo` option also enables caching of sources for any JDK runtime classes, GraalVM classes, and application classes which can be located during native image generation.
41
+
The `-g` option also enables caching of sources for any JDK runtime classes, GraalVM classes, and application classes which can be located during native image generation.
42
42
By default, the cache is created alongside the generated native image in a subdirectory named `sources`.
43
43
If a target directory for the image is specified using option `-H:Path=...` then the cache is also relocated under that same target.
44
44
A command line option can be used to provide an alternative path to `sources`.
@@ -157,7 +157,7 @@ type = class java.lang.String : public java.lang.Object {
157
157
}
158
158
```
159
159
160
-
The ptype command can also be used to identify the type of Java
160
+
The ptype command can also be used to identify the static type of a Java
161
161
data value. The current example session is for a simple hello world
162
162
program. Main method `Hello.main` is passed a single parameter
163
163
`args` whose Java type is `String[]`. If the debugger is stopped at
@@ -176,7 +176,7 @@ There are a few details worth highlighting here. Firstly, the debugger
176
176
sees a Java array reference as a pointer type, as it does every Java object
177
177
reference.
178
178
179
-
Secondly, the pointer points to a structure, actually a C++ class,
179
+
Secondly, the pointer points to a structure, actually a C++ class,
180
180
that models the layout of the Java array using an integer length field
181
181
and a data field whose type is a C++ array embedded into the block of
182
182
memory that models the array object.
@@ -290,6 +290,13 @@ makes it possible to perform a simple test to decide if an address
290
290
is an object reference and, if so, what the object's class is.
291
291
Given a valid object reference it is always possible to print the
292
292
contents of the `String` referenced from the hub's name field.
293
+
294
+
Note that as a consequence, this allows every object observed by the debugger
295
+
to be downcast to its dynamic type. i.e. even if the debugger only sees the static
296
+
type of e.g. java.nio.file.Path we can easily downcast to the dynamic type, which
297
+
might be a subtype such as `jdk.nio.zipfs.ZipPath`, thus making it possible to inspect
298
+
fields that we would not be able to observe from the static type alone.
299
+
293
300
First the value is cast to an object reference.
294
301
Then a path expression is used to dereference through the the `hub` field and the `hub`'s name field to the `byte[]` value array located in the name `String`.
295
302
@@ -611,7 +618,7 @@ The *rawline* segment provides details of how the line table is generated using
611
618
The *loc* section provides details of address ranges within
612
619
which parameter and local variables declared in the info section
613
620
are known to have a determinate value. The details identify where
614
-
the value islocated, either in a machine register, on the stack or
621
+
the value is located, either in a machine register, on the stack or
615
622
at a specific address in memory.
616
623
617
624
The *str* section provides a lookup table for strings referenced from records in the info section.
0 commit comments