Skip to content

Commit 94deee8

Browse files
committed
Changes after review feedback.
1 parent fab10a1 commit 94deee8

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

docs/reference-manual/native-image/DebugInfo.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ line flag to the `native-image` command
2828
native-image -g -H:+SourceLevelDebug Hello
2929
```
3030

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
3232
native image is compiled and does not affect how fast it executes nor how much memory it uses at runtime.
3333
However, it can significantly increase the size of the generated image on disk. Enabling full parameter
3434
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.
3838
3939
## Source File Caching
4040

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.
4242
By default, the cache is created alongside the generated native image in a subdirectory named `sources`.
4343
If a target directory for the image is specified using option `-H:Path=...` then the cache is also relocated under that same target.
4444
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 {
157157
}
158158
```
159159

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
161161
data value. The current example session is for a simple hello world
162162
program. Main method `Hello.main` is passed a single parameter
163163
`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
176176
sees a Java array reference as a pointer type, as it does every Java object
177177
reference.
178178

179-
Secondly, the pointer points to a structure, actually a C++ class,
179+
Secondly, the pointer points to a structure, actually a C++ class,
180180
that models the layout of the Java array using an integer length field
181181
and a data field whose type is a C++ array embedded into the block of
182182
memory that models the array object.
@@ -290,6 +290,13 @@ makes it possible to perform a simple test to decide if an address
290290
is an object reference and, if so, what the object's class is.
291291
Given a valid object reference it is always possible to print the
292292
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+
293300
First the value is cast to an object reference.
294301
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`.
295302

@@ -611,7 +618,7 @@ The *rawline* segment provides details of how the line table is generated using
611618
The *loc* section provides details of address ranges within
612619
which parameter and local variables declared in the info section
613620
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
615622
at a specific address in memory.
616623

617624
The *str* section provides a lookup table for strings referenced from records in the info section.

0 commit comments

Comments
 (0)