GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support advanced stack walking features with cstack=vm by apangin · Pull Request #1537 · async-profiler/async-profiler

Conversation

@apangin

@apangin apangin commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator

Description

This PR is a prerequisite to making cstack=vm the default stack walking mode.
It includes the following changes:

  1. vm and vmx are no longer different stack walking modes. It's now a single vm mode with an optional mixed feature. There is already -F argument for choosing various stack walking features, and the ability to display mixed stack (where native frames interleave Java frames) fits this paradigm well. cstack=vmx remains for backward compatibility as a shorthand for cstack=vm,features=mixed.
  2. StackDetail enum is gone. Now, I pass features argument instead.
  3. VMStructs stack walker now supports vtable and comptask features.
  4. For nativemem profiles, I chop everything above malloc hook frames, similarly to fp and dwarf modes.

I haven't changed logic around allocation and lock profiling. They still use JVMTI API for getting stack traces. This will keep familiar user experience after switching to vm by default.

Related issues

#1533, #1370

Motivation and context

VMStructs should support all stack walking features that fp and dwarf modes do.

How has this been tested?

--cstack vm -F comptask+vtable

Integration tests will be amended in the subsequent PR that changes default mode.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@apangin
Support comptask and vtable features with cstack=vm
f9b68dc
@Baraa-Hasheesh

Baraa-Hasheesh commented Oct 15, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I haven't changed logic around allocation

But wouldn't that keep the known issue of allocation profiling not collecting native samples for alloc samples when vm is selected?
For example the following samples

image image

When using VM stack walker they won't have these native frames,
This is because we're skipping native portion for vm on the Profiler::getNativeTrace function & only collect the java samples using the JVMTI stack walker

You can test this change against the AllocTests.startup I think it will fail if you enable vm

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Baraa-Hasheesh
Baraa-Hasheesh reviewed Oct 15, 2025
View reviewed changes
Comment thread src/stackWalker.cpp
}
continue;
} else {
if (features.vtable_target && nm->isVTableStub() && depth == 0) {

@Baraa-Hasheesh Baraa-Hasheesh Oct 15, 2025

Copy link
Copy Markdown
Contributor

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.

can we add a test for this?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@apangin apangin Oct 15, 2025

Copy link
Copy Markdown
Collaborator Author

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.

Added tests for vtable stub and itable stub

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@apangin
vtable tests
502f2a4
@apangin

apangin commented Oct 15, 2025

Copy link
Copy Markdown
Collaborator Author

@Baraa-Hasheesh You are right: ideally, allocation profiling should use VMStructs stack walker too. But let's do it in a separate PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@apangin
apangin merged commit 5aee9cd into async-profiler:master Oct 15, 2025
@Baraa-Hasheesh

Baraa-Hasheesh commented Oct 15, 2025

Copy link
Copy Markdown
Contributor

@Baraa-Hasheesh You are right: ideally, allocation profiling should use VMStructs stack walker too. But let's do it in a separate PR.

That's should be fine

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Baraa-Hasheesh Baraa-Hasheesh mentioned this pull request Oct 15, 2025
Fully use VM stack walker when selected & general enhancements for VM/VMX modes #1370
Closed
This was referenced Oct 15, 2025
Use VMStructs stack walking mode by default #1539
Merged
Fix Duplicated native stacks when mixed feature is used for FP & Dwarf stack walkers #1546
Merged
jbachorik pushed a commit to DataDog/async-profiler that referenced this pull request Jan 2, 2026
@apangin @jbachorik
Support advanced stack walking features with cstack=vm (async-profile…
a8773f0
…r#1537)
jbachorik pushed a commit to DataDog/async-profiler that referenced this pull request Jan 6, 2026
@apangin @jbachorik
Support advanced stack walking features with cstack=vm (async-profile…
714cc4a
…r#1537)
@jbachorik jbachorik mentioned this pull request May 7, 2026
fix(profiler): make _class_map access signal-safe in walkVM DataDog/java-profiler#512
Merged
2 of 3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@Baraa-Hasheesh Baraa-Hasheesh Baraa-Hasheesh left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@apangin @Baraa-Hasheesh
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.