Giter Site home page Giter Site logo

Crash on `info locals` on OS X about delve HOT 3 CLOSED

go-delve avatar go-delve commented on August 22, 2024
Crash on `info locals` on OS X

from delve.

Comments (3)

derekparker avatar derekparker commented on August 22, 2024

Thanks, I was just able to reproduce this locally. Looks like an issue with cgo enabled programs (in your example, include net/http enables cgo).

I'll investigate this.

from delve.

bforsyth927 avatar bforsyth927 commented on August 22, 2024

My friend and I hit this issue and debugged through it. At least for all the cases we hit (both for 'info vars' and 'info locals') the underlying issue was always that it was drilling into an array of strings. And it would blow up when one of the strings was nil (length == 0, ptr == 0). The fix or workaround I used in my own copy of Delve is pretty straightforward. Basically just return the empty string "" out of readString, rather than attempting to dereference a null pointer and construct a string struct at that bogus address. I'm happy to generate a pull request if you like. But I'm not (yet) set up to run tests with Delve so it might be a few days before I can get around to it. What would you like me to do?

diff --git a/proctl/variables.go b/proctl/variables.go
index 4554bc4..f0735bf 100644
--- a/proctl/variables.go
+++ b/proctl/variables.go
@@ -693,6 +693,10 @@ func (thread *ThreadContext) readString(addr uintptr) (string, error) {
}
addr = uintptr(binary.LittleEndian.Uint64(val))

  •   if addr == 0 {
    
  •           return "", err
    
  •   }
    
  • val, err = thread.readMemory(addr, strlen)
    if err != nil {
            return "", err
    

from delve.

derekparker avatar derekparker commented on August 22, 2024

@bforsyth927 that looks like a pretty reasonable patch. If you submit a PR I'll merge it in.

from delve.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.