Bug 27234 - gdb.Value causes abort when converted to string
Summary: gdb.Value causes abort when converted to string
Status: WAITING
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 10.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-24 16:00 UTC by grazfather
Modified: 2025-03-06 18:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2023-04-17 00:00:00
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description grazfather 2021-01-24 16:00:52 UTC
This was reported via github: https://github.com/hugsy/gef/issues/593, but it's a bug in GDB.

Compile the following go code:

```
package main

import (
       "fmt"
)

func main() {
       fmt.Printf("hi");
}
```

for x86_64.

Open it in GDB 10.1

b main.main
run
ni 7

Now run in a python interpreter
```
current_frame = gdb.selected_frame()
frame_args = gdb.FrameDecorator.FrameDecorator(current_frame).frame_args() or []
values = [x.sym.value(current_frame) for x in frame_args]
# You should get a list of four values
# value 1 can be converted to a string
str(values[1])
# This will abort
str(values[0])
```
Comment 1 grazfather 2021-01-24 16:13:52 UTC
GNU gdb (Ubuntu 10.1-1.6ubuntu1) 10.1.90.20210103-git
Comment 2 Tom Tromey 2022-06-11 19:27:36 UTC
I tried this and it worked for me.
However I don't know Go.
How exactly did you compile it?
Comment 3 grazfather 2022-06-20 14:48:29 UTC
Simply with `go build x.go`
Comment 4 Tom Tromey 2023-04-17 16:55:02 UTC
With Fedora 36 gdb (12.1) I don't see a crash.
Could you try a newer gdb?  I wonder if it's been fixed.

Also, FTR, I had to use the golang go (not gcc.go) to
even get these values.
Comment 5 grazfather 2025-03-06 18:13:38 UTC
I can still reproduce this on GDB 12.1 from ubuntu 22.04.2 installed via apt-get.

Will work to reproduce on 16.2