Skip to content
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

Index out of range using gdlv debug #79

Open
Zettexe opened this issue Sep 3, 2024 · 5 comments
Open

Index out of range using gdlv debug #79

Zettexe opened this issue Sep 3, 2024 · 5 comments

Comments

@Zettexe
Copy link

Zettexe commented Sep 3, 2024

Window shows up for a moment then immediately crashes:

gdlv debug github.com/jezek/xgb/xgbgen -- --package xkb --gofmt=false --proto-path ./xml/src ./xml/src/xkb.xml
panic: runtime error: index out of range [5] with length 5

goroutine 24 [running]:
github.com/aarzilli/nucular/richtext.(*RichText).reflow(0xc0001d0008)
	github.com/aarzilli/nucular@v0.0.0-20240117103348-47eb8d7bfc14/richtext/draw.go:519 +0xc77
github.com/aarzilli/nucular/richtext.(*Ctor).End(0xc0001d00a8)
	github.com/aarzilli/nucular@v0.0.0-20240117103348-47eb8d7bfc14/richtext/rtxt.go:501 +0xa1e
main.(*editorWriter).Write(0xc0000de000?, {0xc00010e010, 0x5, 0x0?})
	github.com/aarzilli/gdlv/scrollback.go:49 +0x692
fmt.Fprintf({0x8f0aa0, 0xc00010e000}, {0x84cf6d, 0x5}, {0x0, 0x0, 0x0})
	fmt/print.go:225 +0x97
main.(*ServerDescr).Rebuild(0xb90a40)
	github.com/aarzilli/gdlv/server.go:368 +0x10d
main.(*ServerDescr).Start(0x0?)
	github.com/aarzilli/gdlv/server.go:275 +0x26
created by main.main in goroutine 1
	github.com/aarzilli/gdlv/main.go:1140 +0x425
make: *** [Makefile:62: xkb.delve] Error 2
@aarzilli
Copy link
Owner

aarzilli commented Sep 4, 2024

I can't reproduce this. Can you add a fmt.Printf("adding %q %d\n", string(b), scrollbackEditor.Width) at gdlv/scrollback.go:48, so I can see if maybe I can figure it out.

Also how did you install gdlv? This doesn't look like it was installed with go install because it lacks the vendor directory. Were other changes made?

@Zettexe
Copy link
Author

Zettexe commented Sep 4, 2024

I installed it with the Nix package manager, should be version 1.12.0 but I don't know if there is a way to verify that with the program itself. Installing it with go install has it working perfectly well and the Nix version I cant change the code in.

@Zettexe
Copy link
Author

Zettexe commented Sep 4, 2024

Actually now it seems to be working even with the Nix installed binary... unclear on what the issue was but maybe it was using the old version (1.10.0)?

Would be nice if we could see the version by using a command line flag maybe.

@Zettexe
Copy link
Author

Zettexe commented Sep 4, 2024

Also, doesnt quite work as expected, seem to be getting some cgo error:

Loading init file "/home/zettexe/.config/gdlv.star"...done
Compiling...done
# runtime/cgo
In file included from /nix/store/1vp54ln0frvhzgasr2a377mfbwvqdm6i-glibc-2.39-52-dev/include/bits/libc-header-start.h:33,
                 from /nix/store/1vp54ln0frvhzgasr2a377mfbwvqdm6i-glibc-2.39-52-dev/include/stdlib.h:26,
                 from _cgo_export.c:3:
/nix/store/1vp54ln0frvhzgasr2a377mfbwvqdm6i-glibc-2.39-52-dev/include/features.h:414:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
  414 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
cc1: all warnings being treated as errors

@aarzilli
Copy link
Owner

aarzilli commented Sep 5, 2024

Actually now it seems to be working even with the Nix installed binary... unclear on what the issue was but maybe it was using the old version (1.10.0)?

The stacktrace looks like it comes from the latest version. Some other thing probably changed.

Also, doesnt quite work as expected, seem to be getting some cgo error:

This is because delve sets CGO_CFLAGS to -O0 -g and nix has compiler changes that force optimizations, you have to set CGO_CFLAGS to -g yourself.

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

No branches or pull requests

2 participants