JDK-8242152 : SA does not include StackMapTables when dumping .class files
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 8,9,14,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-04-04
  • Updated: 2023-12-15
  • Resolved: 2023-06-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b04Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
There are a number of ways to get SA to dump the in memory version of a class into a .class file. For example, within clhsdb the buildreplayjars and dumpclass commands both do so, as does the SA ClassDump "tool", which is effectively the same as buildreplayjars. All of these rely on the ClassWriter class to generate the .class file, but it neglects to include the StackMapTable code attributes when dumping. This result in a VerifyError for classefile versions 51 and later (JDK 1.7) when trying to use these classes.

It might not be too hard to get ClassWriter to include StackMapTable code attributes. They can be found in the ConstMethod::_stackmap_data field. However, it's unclear if this is all that is needed to make these dumped classes runnable. It appears that classes have not been runnable since JDK 1.7, and probably there are other classfile changes since then that ClassWriter is not aware of and needs to be.
Comments
This needs a jdk21u-dev PR before being applicable for approval.
15-12-2023

Fix request (21u) Clean backport, no tier1 regressions except "serviceability/sa/ClhsdbDumpclass" - it will fail until JDK-8310618 is backport'ed (PR chain created).
04-09-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u/pull/129 Date: 2023-09-04 09:20:01 +0000
04-09-2023

Changeset: 8e047029 Author: Daohan Qu <dqu@openjdk.org> Committer: Serguei Spitsyn <sspitsyn@openjdk.org> Date: 2023-06-22 06:45:19 +0000 URL: https://git.openjdk.org/jdk/commit/8e047029e811a9e5758d564249ee794f584c9dc2
22-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14556 Date: 2023-06-20 11:31:40 +0000
20-06-2023