Skip to content

fix maymorestack gcflag hook instrumentation#1910

Draft
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-maymorestack-coverage
Draft

fix maymorestack gcflag hook instrumentation#1910
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-maymorestack-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 24, 2026

Summary

  • Parse -gcflags=-d=maymorestack=... and carry the hook into the llgo build config.
  • Emit the mayMoreStack hook at ordinary Go function entry for the hook's package, skipping synthetic initializers and the hook function itself.
  • Add stable test/go CLI coverage and remove only the covered maymorestack.go GOROOT xfails.

Coverage

Covered:

  • test/go builds and runs a temporary program with -gcflags=-d=maymorestack=main.mayMoreStack and checks the hook count.
  • Focused GOROOT maymorestack.go passes locally for Go 1.24.11, 1.25.0, and 1.26.0.
  • Parser coverage includes direct, pattern-prefixed, space-separated, and comma-separated -d forms.

Not covered / intentionally out of scope:

  • caller/debugline metadata, nil, channel, print, recover, GC/liveness/finalizer/goroutine work.
  • Runtime package changes; this PR only adds compiler-side hook instrumentation and CLI flag plumbing.
  • Local focused GOROOT runs were on darwin/arm64; linux coverage is left to PR CI.

Tests

  • go test ./cmd/internal/flags -count=1
  • go test ./cmd/internal/build -count=1
  • go test ./cl -count=1
  • go test ./test/go -count=1
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 20m -args -goroot /Users/lijie/sdk/go1.24.11 -dirs . -case '^maymorestack\\.go$' -directive-mode ci -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 45s -build-timeout 5m
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 20m -args -goroot /Users/lijie/sdk/go1.25.0 -dirs . -case '^maymorestack\\.go$' -directive-mode ci -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 45s -build-timeout 5m
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 20m -args -goroot /Users/lijie/sdk/go1.26.0 -dirs . -case '^maymorestack\\.go$' -directive-mode ci -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 45s -build-timeout 5m
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 20m -args -goroot /Users/lijie/sdk/go1.24.11 -dirs . -case '^maymorestack\\.go$' -directive-mode ci -run-timeout 45s -build-timeout 5m
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 20m -args -goroot /Users/lijie/sdk/go1.25.0 -dirs . -case '^maymorestack\\.go$' -directive-mode ci -run-timeout 45s -build-timeout 5m
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 20m -args -goroot /Users/lijie/sdk/go1.26.0 -dirs . -case '^maymorestack\\.go$' -directive-mode ci -run-timeout 45s -build-timeout 5m
  • go test ./cmd/internal/... -count=1
  • go test ./ssa -count=1
  • go test ./internal/build -count=1

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 39.39394% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cl/compile.go 39.39% 20 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants