Skip to content

gdb can't print local variables, they're always "optimized out"? #1825

@dkegel-fastly

Description

@dkegel-fastly

On linux on amd64, gdb can do info variables to see globals, but info locals usually lists all the variables as optimized out.

This is the case even with

tinygo -opt 1

I can't go lower; opt 0 fails with

panic: unexpected getFuncPtrCall

goroutine 12 [running]:
github.com/tinygo-org/tinygo/transform.LowerFuncValues(0x7ff9b0002ac0)
	/home/dank/src/tinygo/transform/func-lowering.go:191 +0x11d4
github.com/tinygo-org/tinygo/transform.Optimize(0x7ff9b0002ac0, 0xc0002be0f0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/dank/src/tinygo/transform/optimizer.go:110 +0x1258
github.com/tinygo-org/tinygo/builder.optimizeProgram(0x7ff9b0002ac0, 0xc0002be0f0, 0xc00114f1d0, 0x2)
	/home/dank/src/tinygo/builder/build.go:603 +0x122
github.com/tinygo-org/tinygo/builder.Build.func2(0x0, 0x0)
	/home/dank/src/tinygo/builder/build.go:304 +0x812
github.com/tinygo-org/tinygo/builder.jobWorker(0xc00065b260, 0xc00065b200)
	/home/dank/src/tinygo/builder/jobs.go:153 +0xe2

(This is with dev from mar 29, 35bf074, to work around the crash #1805 .)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions