1. 19 5月, 2018 1 次提交
    • A
      proc/native,proc/gdbserial: let target access terminal · cc86bde5
      aarzilli 提交于
      Change the linux verison of proc/native and proc/gdbserial (with
      debugserver) so that they let the target process use the terminal when
      delve is launched in headless mode.
      
      Windows already worked, proc/gdbserial (with rr) already worked.
      I couldn't find a way to make proc/gdbserial (with lldb-server) work.
      
      No tests are added because I can't think of a way to test for
      foregroundness of a process.
      
      Fixes #65
      cc86bde5
  2. 16 5月, 2018 1 次提交
    • J
      Keep searching for file:line until found · c7cde8b1
      Jay Mundrawala 提交于
      Go seems to be generating multiple compilation units that have
      the same file. I think this happens for functions that get inlined.
      Without this patch, those inlined functions break the ability to set
      a breakpoint at other lines in the file. I was able to load the same
      binary in gdb and set a breakpoints throughout the file without issue.
      
      ```
      ➜ objdump --dwarf=decodedline automate-gateway | grep handler/users.go
      .../handler/users.go:[++]
      s/.../handler/users.go           20            0xb6dd88
      .../handler/users.go:[++]
      s/.../handler/users.go           20            0xb6e50f
      .../handler/users.go:[++]
      s/automate-gateway/handler/users.go           32            0xb66640
      ```
      
      Inlined functions are still a little weird. setting a breakpoint on
      a function that gets inlined picks the first occurence. That being
      said, I think delve should still do something reasonable for the rest
      of the lines in the file.
      c7cde8b1
  3. 10 5月, 2018 1 次提交
  4. 08 5月, 2018 1 次提交
  5. 05 5月, 2018 1 次提交
  6. 27 4月, 2018 1 次提交
  7. 24 4月, 2018 3 次提交
    • A
      proc: Flag shadowed arguments as shadowed · 7fd47749
      aarzilli 提交于
      Fixes #951
      7fd47749
    • A
      proc: cache entire frame in FrameToScope instead of variablesByTag · 21be5946
      aarzilli 提交于
      Caching the frame in variablesByTag is problematic:
      
      1. accounting for variables that are (partially) stored in registers is
      complicated (see issue #1106)
      2. for some types (strings, interfaces...) simply creating the Variable
      object reads memory, which therefore happens before we can do any
      caching.
      
      Instead cache the entire frame when the EvalScope object is created.
      The cached range is between the SP value of the current frame and the
      CFA of the preceeding frame, if available, or the CFA of the current
      frame otherwise.
      
      Fixes #1106
      21be5946
    • A
      proc: change memCache to delay reading · a5574bcd
      aarzilli 提交于
      Change memCache so that the preloaded memory is not read immediately
      but only after the actual read to the preloaded range.
      
      This allows us to request caching the entire stack frame every time we
      create an eval scope and no unnecessary reads will be made even if the
      user is just trying to evaluate a global variable.
      a5574bcd
  8. 20 4月, 2018 2 次提交
  9. 19 4月, 2018 1 次提交
  10. 18 4月, 2018 1 次提交
  11. 14 4月, 2018 4 次提交
    • A
      proc: Short circuit evaluation of && and || like go does · b9c4a1d6
      aarzilli 提交于
      Change evaluation of binary operators so that both && and || only
      evaluate their second argument conditionally, like go does.
      b9c4a1d6
    • A
      proc_test: instrument TestFrameEvaluation · e1f2626b
      aarzilli 提交于
      I've seen TestFrameEvaluation fail in CI in the past. It's been a while
      since the last time and I couldn't reproduce it locally at all. I'd
      like to have some instrumentation in case it happens again.
      e1f2626b
    • A
      terminal: make printcontext use SelectedGoroutine · 4f70ff0a
      aarzilli 提交于
      printcontext should use SelectedGoroutine instead of trusting that the
      goroutine running on current thread matches the SelectedGoroutine.
      
      When the user switches to a parked goroutine CurrentThread and
      SelectedGoroutine will diverge.
      
      Almost all calls to printcontext are safe, they happen after a continue
      command returns when SelectedGoroutine and CurrentThread always agree,
      but the calls in frameCommand and listCommand are wrong.
      
      Additionally we should stop reporting an error when the debugger is
      stopped on an unknown PC address.
      4f70ff0a
    • A
      4e177bb9
  12. 11 4月, 2018 4 次提交
  13. 29 3月, 2018 1 次提交
  14. 28 3月, 2018 1 次提交
  15. 27 3月, 2018 1 次提交
    • A
      proc: support inlining · 290e8e75
      aarzilli 提交于
      Go 1.10 added inlined calls to debug_info, this commit adds support
      for DW_TAG_inlined_call to delve, both for stack traces (where
      inlined calls will appear as normal stack frames) and to correct
      the behavior of next, step and stepout.
      
      The calls to Next and Frame of stackIterator continue to work
      unchanged and only return real stack frames, after reading each line
      appendInlinedCalls is called to unpacked all the inlined calls that
      involve the current PC.
      
      The fake stack frames produced by appendInlinedCalls are
      distinguished from real stack frames by having the Inlined attribute
      set to true. Also their Current and Call locations are treated
      differently. The Call location will be changed to represent the
      position inside the inlined call, while the Current location will
      always reference the real stack frame. This is done because:
      
      * next, step and stepout need to access the debug_info entry of
      the real function they are stepping through
      * we are already manipulating Call in different ways while Current
      is just what we read from the call stack
      
      The strategy remains mostly the same, we disassemble the function
      and we set a breakpoint on each instruction corresponding to a
      different file:line. The function in question will be the one
      corresponding to the first real (i.e. non-inlined) stack frame.
      
      * If the current function contains inlined calls, 'next' will not
      set any breakpoints on instructions that belong to inlined calls. We
      do not do this for 'step'.
      
      * If we are inside an inlined call that makes other inlined
      functions, 'next' will not set any breakpoints that belong to
      inlined calls that are children of the current inlined call.
      
      * If the current function is inlined the breakpoint on the return
      address won't be set, because inlined frames don't have a return
      address.
      
      * The code we use for stepout doesn't work at all if we are inside
      an inlined call, instead we call 'next' but instruct it to remove
      all PCs belonging to the current inlined call.
      290e8e75
  16. 23 3月, 2018 2 次提交
    • Y
      Extend the "frame" command to set the current frame. (#1110) · 82aff3f1
      Yasushi Saito 提交于
      * Extend the "frame" command to set the current frame.
      
      Command
      
        frame 3
      
      sets up so that subsequent "print", "set", "whatis" command
      will operate on frame 3.
      
        frame 3 print foo
      
      continues to work.
      
      Added "up", "down". They move the current frame up or down.
      
      Implementation note:
      
      This changes removes "scopePrefix" mode from the terminal/command.go and instead
      have the command examine the goroutine/frame value to see if it is invoked in a
      scoped context.
      
      * Rename Command.Frame -> Command.frame.
      82aff3f1
    • A
      proc,vendor: show global variables in disassembly · ec8dc3a1
      aarzilli 提交于
      updates vendored version of x86asm, adds a symbol lookup function to
      pass to the disassembler.
      
      This will show global symbol names in the disassembly like go tool
      objdump does.
      ec8dc3a1
  17. 21 3月, 2018 2 次提交
  18. 20 3月, 2018 1 次提交
  19. 16 3月, 2018 1 次提交
  20. 09 3月, 2018 2 次提交
  21. 08 3月, 2018 1 次提交
  22. 07 3月, 2018 6 次提交
    • A
      proc/native: move halt to os specific struct · 6c973bf2
      aarzilli 提交于
      The windows backend isn't using the halt field so it can be removed
      there.
      On linux it can be replaced with a parameter passed to trapWait.
      6c973bf2
    • A
      proc/native: move Thread.running to os struct · 8561db8c
      aarzilli 提交于
      Windows and macOS aren't using this field so move it to the os-specific
      thread struct and remove it from everything except linux.
      8561db8c
    • A
      f26bb0b8
    • A
      proc: remove proc.Process.Halt · e47599d0
      aarzilli 提交于
      The proper way to stop a running process is to call RequestManualStop,
      which most code already did with the exception of some old test code.
      e47599d0
    • A
      proc: remove proc.Process.Kill · ac1aa983
      aarzilli 提交于
      the proper way to kill the target process is to pass true to Detach.
      Everything except old test code did that already.
      ac1aa983
    • A
      proc/native: fix race condition between Halt and process death (linux) · f32ce1b2
      aarzilli 提交于
      If a breakpoint is hit close to process death on a thread that isn't
      the group leader the process could die while we are trying to stop it.
      
      This can be easily reproduced by having the goroutine that's executing
      main.main (which will almost always run on the thread group leader)
      wait for a second goroutine before exiting, then setting a breakpoint
      on the second goroutine and stepping through it (see TestIssue1101 in
      proc_test.go).
      
      When stepping over the return instruction of main.f the deferred
      wg.Done() call will be executed which will cause the main goroutine to
      resume and proceed to exit. Both the temporary breakpoint on wg.Done
      and the temporary breakpoint on the return address of main.f will be in
      close proximity to main.main calling os.Exit() and causing the death of
      the thread group leader.
      
      Under these circumstances the call to native.(*Thread).waitFast in
      native.(*Thread).halt can hang forever due to a bug similar to
      https://sourceware.org/bugzilla/show_bug.cgi?id=12702 (see comment in
      native.(*Thread).wait for an explanation).
      
      Replacing waitFast with a normal wait work in most circumstances,
      however, besides the performance hit, it looks like in this
      circumstances trapWait sometimes receives a spurious SIGTRAP on the
      dying group leader which would cause the subsequent call to wait in
      halt to accidentally reap the process without noting that it did exit.
      
      Instead this patch removes the call to wait from halt and instead calls
      trapWait in a loop in setCurrentBreakpoints until all threads are set
      to running=false. This is also a better fix than the workaround to
      ESRCH error while setting current breakpoints implemented in 94b50d.
      
      Fixes #1101
      f32ce1b2
  23. 06 3月, 2018 1 次提交
    • A
      Documentation: remove homebrew as an install method · fbd152f6
      aarzilli 提交于
      The formula is broken and produces an endless stream of duplicate bug
      reports yet nobody steps up to fix it. Using the formula isn't
      necessary and hasn't been in almost a year, the maintainers of delve
      aren't using it and the original maintainer of the formula vacated.
      fbd152f6