1. 09 5月, 2019 1 次提交
    • A
      proc: allow function calls to appear inside an expression (#1503) · c30a333f
      Alessandro Arzilli 提交于
      The initial implementation of the 'call' command required the
      function call to be the root expression, i.e. something like:
      
      	double(3) + 1
      
      was not allowed, because the root expression was the binary operator
      '+', not the function call.
      
      With this change expressions like the one above and others are
      allowed.
      
      This is the first step necessary to implement nested function calls
      (where the result of a function call is used as argument to another
      function call).
      
      This is implemented by replacing proc.CallFunction with
      proc.EvalExpressionWithCalls. EvalExpressionWithCalls will run
      proc.(*EvalScope).EvalExpression in a different goroutine. This
      goroutine, the 'eval' goroutine, will communicate with the main
      goroutine of the debugger by means of two channels: continueRequest
      and continueCompleted.
      
      The eval goroutine evaluates the expression recursively, when
      a function call is encountered it takes care of setting up the
      function call on the target program and writes a request to the
      continueRequest channel, this causes the 'main' goroutine to restart
      the target program by calling proc.Continue.
      
      Whenever Continue encounters a breakpoint that belongs to the
      function call injection protocol (runtime.debugCallV1 and associated
      functions) it writes to continueCompleted which resumes the 'eval'
      goroutine.
      
      The 'eval' goroutine takes care of implementing the function call
      injection protocol.
      
      When the expression is fully evaluated the 'eval' goroutine will
      write a special message to 'continueRequest' signaling that the
      expression evaluation is terminated which will cause Continue to
      return to the user.
      
      Updates #119
      c30a333f
  2. 27 4月, 2019 1 次提交
    • A
      cmd/dlv: add Go version check (#1533) · 79e0f543
      Alessandro Arzilli 提交于
      Before doing anything check that the version of Go is compatible with
      the current version of Delve.
      This will improve the error message in the case that  another change as
      disruptive as Go1.11 dwarf compression, happens.
      79e0f543
  3. 28 3月, 2019 2 次提交
    • A
      proc,debugger,terminal: read goroutine ancestors · 98265315
      aarzilli 提交于
      Add options to the stack command to read the goroutine ancestors.
      Ancestor tracking was added to Go 1.12 with CL:
      https://go-review.googlesource.com/c/go/+/70993/
      
      Implements #1491
      98265315
    • A
      Miscellaneous logging improvements (#1525) · 48f1f51e
      Alessandro Arzilli 提交于
      * *: use loglevel to control what gets logged instead of output redirection
      
      This stops logrus from doing all the formatting just to discard it
      immediately afterwards.
      
      * logflags: replace default formatter of logrus
      
      The default formatter of logrus emits logs in two different formats
      depending on whether or not the output is going to a terminal. The
      output format for non-terminals is indented to be machine readable, but
      we mostly read logs ourselves and the excessive quoting makes that
      format unreadable.
      When outputting to terminals it uses ANSI escape codes unconditionally,
      without checking whether the terminal it is connected to actually
      supports colors.
      
      This commit replaces the default formatter with a much simpler
      formatter that always uses a more readable format, doesn't use colors
      and places the key-value pairs at the beginning of the line (which is a
      better match for how we use them).
      
      * cmd/dlv: add command line options to redirect logs
      
      Adds two options, --log-to-file and --log-to-fd, to redirect logs to a
      file or to a file descriptor.
      
      When one of those two options is specified the "API server listening
      at:" message will also be redirected to the specified file/file
      descriptor.
      This allows clients that want to use the "API server listening at:"
      message to do so even if they want to redirect the target's stdout to
      another file or device.
      
      Implements #1179, #1523
      48f1f51e
  4. 05 1月, 2019 1 次提交
    • D
      *: Update import name to github.com/go-delve/delve · 4c9a72e4
      Derek Parker 提交于
      The repository is being switched from the personal account
      github.com/derekparker/delve to the organization account
      github.com/go-delve/delve. This patch updates imports and docs, while
      preserving things which should not be changed such as my name in the
      CHANGELOG and in TODO comments.
      4c9a72e4
  5. 21 11月, 2018 2 次提交
  6. 20 11月, 2018 1 次提交
    • S
      proc/proc: Extend GoroutinesInfo to allow specifying a range · 11accd4d
      Sergio Lopez 提交于
      Instead of unconditionally returning all present goroutines,
      GoroutinesInfo now allows specifying a range (start and count). In
      addition to the array of goroutines and the error, it now also returns
      the next goroutine to be processed, to be used as 'start' argument on
      the next call, or 0 if all present goroutines have already been
      processed.
      
      This way clients can avoid eating large amounts of RAM while debugging
      core dumps and processes with a exceptionally high amount of goroutines.
      
      Fixes #1403
      11accd4d
  7. 16 10月, 2018 2 次提交
  8. 12 10月, 2018 1 次提交
    • A
      proc: support position independent executables (PIE) · 74c98bc9
      aarzilli 提交于
      Support for position independent executables (PIE) on the native linux
      backend, the gdbserver backend on linux and the core backend.
      Also implemented in the windows native backend, but it can't be tested
      because go doesn't support PIE on windows yet.
      74c98bc9
  9. 09 10月, 2018 1 次提交
  10. 03 10月, 2018 1 次提交
    • A
      proc/native,Makefile: allow compiling on macOS without native backend · 910f90c3
      aarzilli 提交于
      On macOS 10.14 Apple changed the command line tools so that system
      headers now need to be manually installed.
      
      Instead of adding one extra install step to the install procedure add a
      build tag to allow compilation of delve without the native backend on
      macOS. By default (i.e. when using `go get`) this is how delve will be
      compiled on macOS, the make script is changed to enable compiling the
      native backend if the required dependencies have been installed.
      
      Insure that both configuration still build correctly on Travis CI and
      change the documentation to describe how to compile the native backend
      and that it isn't normally needed.
      
      Fixes #1359
      910f90c3
  11. 20 9月, 2018 1 次提交
  12. 16 8月, 2018 1 次提交
  13. 25 7月, 2018 1 次提交
    • A
      proc,service,terminal: read defer list · 8f1fc63d
      aarzilli 提交于
      Adds -defer flag to the stack command that decorates the stack traces
      by associating each stack frame with its deferred calls.
      
      Reworks proc.next to use this feature instead of using proc.DeferPC,
      laying the groundwork to implement #1240.
      8f1fc63d
  14. 14 7月, 2018 1 次提交
  15. 27 6月, 2018 1 次提交
    • A
      proc,terminal,service: let headless instances run without connected clients · 9a216211
      aarzilli 提交于
      This pull request makes several changes to delve to allow headless
      instancess that are started with the --accept-multiclient flag to
      keep running even if there is no connected client. Specifically:
      
      1. Makes a headless instance started with --accept-multiclient quit
          after one of the clients sends a Detach request (previously they
          would never ever quit, which was a bug).
      2. Changes proc/gdbserial and proc/native so that they mark the
          Process as exited after they detach, even if they did not kill the
          process during detach. This prevents bugs such as #1231 where we
          attempt to manipulate a target process after we detached from it.
      3. On non --accept-multiclient instances do not kill the target
          process unless we started it or the client specifically requests
          it (previously if the client did not Detach before closing the
          connection we would kill the target process unconditionally)
      4. Add a -c option to the quit command that detaches from the
          headless server after restarting the target.
      5. Change terminal so that, when attached to --accept-multiclient,
          pressing ^C will prompt the user to either disconnect from the
          server or pause the target process. Also extend the exit prompt to
          ask if the user wants to keep the headless server running.
      
      Implements #245, #952, #1159, #1231
      9a216211
  16. 22 6月, 2018 1 次提交
    • D
      *: Use structured logging · a208c897
      Derek Parker 提交于
      Implements structured logging via Logrus. This gives us a logger per
      boundry that we care about, allowing for easier parsing of logs if users
      have more than one log option enabled. Also, cleans up a lot of
      conditionals in the code by simply silencing the logger at creation as
      opposed to conditionally logging everywhere.
      a208c897
  17. 12 6月, 2018 1 次提交
    • A
      proc,service: display return values when stepping out of a function · 60c58acb
      aarzilli 提交于
      Displays the return values of the current function when we step out of
      it after executing a step, next or stepout command.
      
      Implementation of this feature is tricky: when the function has
      returned the return variables are not in scope anymore. Implementing
      this feature requires evaluating variables that are out of scope, using
      a stack frame that doesn't exist anymore.
      
      We can't calculate the address of these variables when the
      next/step/stepout command is initiated either, because between that
      point and the time where the stepout breakpoint is actually hit the
      goroutine stack could grow and be moved to a different memory address.
      60c58acb
  18. 20 4月, 2018 1 次提交
  19. 20 3月, 2018 1 次提交
  20. 06 1月, 2018 1 次提交
  21. 03 1月, 2018 1 次提交
  22. 31 8月, 2017 1 次提交
  23. 02 8月, 2017 2 次提交
  24. 27 7月, 2017 2 次提交
  25. 30 6月, 2017 1 次提交
  26. 13 6月, 2017 1 次提交
  27. 06 5月, 2017 1 次提交
  28. 22 4月, 2017 1 次提交
  29. 20 4月, 2017 1 次提交
  30. 19 4月, 2017 1 次提交
  31. 23 2月, 2017 1 次提交
    • A
      proc/stack: use BP when FDE is not available · 92faa95b
      aarzilli 提交于
      On Windows we can sometimes encounter threads stopped in locations for
      which we do not have entries in debug_frame.
      These cases seem to be due to calls to Windows API in the go runtime,
      we can still produce a (partial) stack trace in this circumstance by
      following frame pointers (starting with BP).
      We still prefer debug_frame entries when available since go functions
      do not have frame pointers before go1.8.
      92faa95b
  32. 09 2月, 2017 1 次提交
  33. 08 2月, 2017 2 次提交
    • A
      proc: Make sure CurrentLoc of G returned by GetG is up to date (#723) · 8c96e275
      Alessandro Arzilli 提交于
      We are already doing this in GoroutinesInfo we should be doing it for
      GetG. The main consequence of not doing this is that the CurrentLoc of
      DebuggerState.SelectedGoroutine is out of date compared to the location
      of the thread running it.
      8c96e275
    • A
      Go 1.8 compatibility (part 2) (#667) · 8724b3fc
      Alessandro Arzilli 提交于
      * dwarf/line: bugfix: not all values of the state machine can be used
      
      According to DWARF Version 3 Section 6.2 "Line Number Information" not
      all the values transversed by the line numbers state machine are valid
      instructions, only the ones after a "special opcode", after the
      standard opcode DW_LNS_copy and the extended opcode
      DW_LINE_end_sequence.
      
      DWARF3 describes this by specifying that only the opcodes listed above
      "append a row to the matrix".
      
      Additionally the implementation of DW_LNS_const_add_pc was wrong.
      
      Fixes #664
      
      * dwarf/line: fixed test failing with go1.8
      
      * service/test: fix prologue detection tests
      
      The conditions about which function prologue is emitted by the compiler
      changed in go1.8, changed the test program so that callme2 will still
      have a prologue under go1.8.
      
      * service/test: fix step test
      
      compilation units are linked in a different order under go1.8 so the
      code of 'fmt' is no longer located after 'main' in the executable,
      changed the tests so that they don't rely on this assumption anymore.
      
      * proc: change runtime.Breakpoint support for go1.8
      
      Before 1.8 it was sufficient to step twice to exit a
      runtime.Breakpoint(), but go 1.8 added frame pointer tracking to small
      functions making runtime.Breakpoint longer.
      This changes runtime.Breakpoint handling in Continue to single step as
      many times as are needed to exit runtime.Breakpoint.
      
      * proc/test: fix TestIssue561 for go1.8
      8724b3fc
  34. 06 1月, 2017 1 次提交