-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[GR-48384] Update GDB debugging support for Native Image with gdb-debughelpers.py. #8886
Conversation
|
||
##### Limitations | ||
|
||
The `print` still uses its default implementation, as there is no way to overwrite it, while still keeping the capability of the default `print` command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be: The print
command still uses ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's very interesting, thanks @dominikmascherbauer!
I know this is still WIP, but I added a few comments for your consideration.
|
||
The pretty printer also supports printing of the primitive value instead of a Java Object for boxed primitives. | ||
|
||
Whenever printing is done via the `p` (alias for `print`) the pretty printer intercepts that call to perform type casts to the respective runtime types of Java Objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever printing is done via the `p` (alias for `print`) the pretty printer intercepts that call to perform type casts to the respective runtime types of Java Objects. | |
Whenever printing is done via the `p` alias of the `print` command the pretty printer intercepts that call to perform type casts to the respective runtime types of Java Objects. |
|
||
Whenever printing is done via the `p` (alias for `print`) the pretty printer intercepts that call to perform type casts to the respective runtime types of Java Objects. | ||
This also applies for auto-completion when using the `p` command. | ||
This means, if the static type is different to the runtime type, `print` uses the static types, which leaves finding out the runtime types and type casting to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means, if the static type is different to the runtime type, `print` uses the static types, which leaves finding out the runtime types and type casting to the user. | |
This means that if the static type is different to the runtime type, the `print` command uses the static types, which leaves finding out the runtime types and type casting to the user. |
The pretty printer also supports printing of the primitive value instead of a Java Object for boxed primitives. | ||
|
||
Whenever printing is done via the `p` (alias for `print`) the pretty printer intercepts that call to perform type casts to the respective runtime types of Java Objects. | ||
This also applies for auto-completion when using the `p` command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also applies for auto-completion when using the `p` command. | |
This also applies for auto-completion when using the `p` alias. |
Whenever printing is done via the `p` (alias for `print`) the pretty printer intercepts that call to perform type casts to the respective runtime types of Java Objects. | ||
This also applies for auto-completion when using the `p` command. | ||
This means, if the static type is different to the runtime type, `print` uses the static types, which leaves finding out the runtime types and type casting to the user. | ||
Additionally, the `p` command understands Java field and array access and function calls for Java Objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, the `p` command understands Java field and array access and function calls for Java Objects. | |
Additionally, the `p` alias understands Java field and array access and function calls for Java Objects. |
|
||
#### Options for controlling the behavior of the SVM Pretty Printer | ||
|
||
In addition to the enhanced `p` command `svmhelpers.py` introduces some GDB parameters to customize the behavior of the SVM Pretty Printer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the enhanced `p` command `svmhelpers.py` introduces some GDB parameters to customize the behavior of the SVM Pretty Printer. | |
In addition to the enhanced `p` alias, `svmhelpers.py` introduces some GDB parameters to customize the behavior of the SVM Pretty Printer. |
* ##### svm-print-string-limit <int> | ||
|
||
Allows to customize the maximum length for pretty printing Java Strings. | ||
The default value is 200, set to -1 or _unlimited_ for unlimited printing of Java Strings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think wrapping the values in backtickes will make this more readable
The default value is 200, set to -1 or _unlimited_ for unlimited printing of Java Strings. | |
The default value is `200`, set to `-1` or `_unlimited_` for unlimited printing of Java Strings. |
If you agree please apply to the rest of the options as well.
svmhelpers_py = join(mx.dependency('com.oracle.svm.hosted.image.debug').output_dir(), 'svmhelpers.py') | ||
|
||
test_python_source_dir = join(test_source_path, 'com', 'oracle', 'svm', 'test', 'debug', 'helper') | ||
gdb_utils_py = join(test_python_source_dir, 'gdb_util.py') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this come from? Should it maybe be:
gdb_utils_py = join(test_python_source_dir, 'gdb_util.py') | |
gdb_utils_py = join(test_python_source_dir, 'gdb_helper.py') |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out, it's not needed here anymore, I forgot to remove it.
gdb_helper is now imported directly in the testscripts like that:
# add test directory to path to allow import of gdb_helper.py
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__))))
from gdb_helper import *
… Image debugging experience
Fixes the following mx issue: ``` Traceback (most recent call last): File "/Users/lewurm/work/mx/src/mx/_impl/mx_gate.py", line 492, in gate _run_gate(cleanArgs, args, tasks) File "/Users/lewurm/work/mx/src/mx/_impl/mx_gate.py", line 793, in _run_gate runner(args, tasks) File "/Users/lewurm/work/graal-enterprise/graal-enterprise/mx.graal-enterprise/mx_graal_enterprise.py", line 308, in _enterprise_gate_runner maxJavaCompliance = max([d.maxJavaCompliance() for d in mx.dependencies() if d.isJARDistribution()]) File "/Users/lewurm/work/mx/src/mx/_impl/support/comparable.py", line 50, in __lt__ return self._checked_cmp(other, lambda a, b: a < b) File "/Users/lewurm/work/mx/src/mx/_impl/support/comparable.py", line 46, in _checked_cmp compar = self.__cmp__(other) # pylint: disable=assignment-from-no-return File "/Users/lewurm/work/mx/src/mx/_impl/mx_javacompliance.py", line 214, in __cmp__ return mx.compare(self._parts, other._parts) AttributeError: 'NoneType' object has no attribute '_parts' ```
No description provided.