1. 31 8月, 2018 4 次提交
    • A
      proc,service,terminal: information about stack trace truncation · ac74944d
      aarzilli 提交于
      Add a flag to Stackframe that indicates where the stack frame is the
      bottom-most frame of the stack. This allows clients to know whether the
      stack trace terminated normally or if it was truncated because the
      maximum depth was reached.
      Add a truncation message to the 'stack' command.
      ac74944d
    • A
      proc/native: implement Copy/RestoreRegisters on windows · b8e80746
      aarzilli 提交于
      b8e80746
    • A
      proc: replace SavedRegisters interface with a Copy method · 438e51f3
      aarzilli 提交于
      Fncall.go was written with the assumption that the object returned by
      proc.Thread.Registers does not change after we call
      proc.Thread.SetPC/etc.
      
      This is true for the native backend but not for gdbserial. I had
      anticipated this problem and introduced the Save/SavedRegisters
      mechanism during the first implementation of fncall.go but that's
      insufficient.
      
      Instead:
      
      1. clarify that the object returned by proc.Thread.Registers could
         change when the CPU registers are modified.
      2. add a Copy method to Registers that returns a copy of the registers
         that are guaranteed not to change when the CPU registers change.
      3. remove the Save/SavedRegisters mechanism.
      
      This solution leaves us the option, in the future, to cache the output
      of proc.(Thread).Registers, avoiding a system call every time it's
      called.
      438e51f3
    • D
      Add function call support for OSX · f1e66f07
      Derek Parker 提交于
      Implements missing functionality in gdbserial to enable function calls
      on OSX.
      f1e66f07
  2. 30 8月, 2018 2 次提交
    • A
      proc: fix type of some struct global variables · 0461af83
      aarzilli 提交于
      Normally variables that have a named struct as a type will get a
      typedef entry as their type, sometimes however the Go linker will
      decide to use the DW_TAG_structure_type entry instead.
      
      For consistency always wrap a struct type into a typedef when we are
      creating a new variables (see comment in newVariable for exceptions).
      
      This fixes a bug where it would be impossible to call methods on a
      global variable.
      0461af83
    • A
      proc: fix next when disassembly fails · cab09a4b
      aarzilli 提交于
      Next should work even if one or more instructions in the current
      function can not be disassembled.
      cab09a4b
  3. 17 8月, 2018 5 次提交
  4. 16 8月, 2018 2 次提交
    • A
      proc: use (*Variable).setValue in fncall · 9335c540
      aarzilli 提交于
      9335c540
    • A
      proc: change (*Variable).setValue for use in CallFunction · 12a3f8bb
      aarzilli 提交于
      Changes (*Variable).setValue so that it can be used in CallFunction to
      set up the argument frame for the function call, adding the ability to:
      - nil nillable types
      - set strings to the empty string
      - copy from one structure to another (including strings and slices)
      - convert any interface type to interface{}
      - convert pointer shaped types (map, chan, pointers, and structs
        consisting of a single pointer field) to interface{}
      
      This covers all cases where an assignment statement can be evaluated
      without allocating memory or calling functions in the target process.
      12a3f8bb
  5. 08 8月, 2018 2 次提交
  6. 01 8月, 2018 3 次提交
    • B
      Add an edit command · 22af3836
      Ben Cotterell 提交于
      Which I miss from gdb-- it's nice to be able to open where you are in
      your editor where you're already working on the project you're
      debugging.
      22af3836
    • A
      proc/native,proc/gdbserial: ignore SIGTTIN, SIGTTOU when fg'ing target · 7e15327e
      aarzilli 提交于
      If we send a process to foreground while the headless instance may get
      a SIGTTOU/SIGTTIN, if not ignored this signal will stop the headless.
      It's not clear why this only happens the second time we do this but
      that's how it is.
      
      Also removes the direct syscall to TIOCSPGRP and lets the go runtime do
      it instead.
      
      Fixes #1279
      7e15327e
    • A
      dwarf/line: fix some bugs with the state machine · 3f9875e2
      aarzilli 提交于
      Adds a test that compares the output of our state machine with the
      output of the debug_line reader in the standard library and checks that
      they produce the same output for the debug_line section of grafana as
      compiled on macOS (which is the most interesting case since it uses cgo
      and therefore goes through dsymutil).
      
      A few bugs were uncovered and fixed:
      
      1. is_stmt was reset improperly after a DW_LNS_end_sequence instruction
      2. basic_block, prologue_end and epilogue_begin were not reset after a
         DW_LNS_copy instruction
      3. some opcodes were not decoded properly if the debug_line section
         declares fewer standard opcodes than we know about.
      
      Fixes #1282
      3f9875e2
  7. 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
  8. 24 7月, 2018 2 次提交
    • A
      terminal: disable next/step/stepout if current frame isn't 0 · 932aad9e
      aarzilli 提交于
      next/step/stepout should work even if the current frame isn't the
      topmost stack frame, but their behavior should be different in that
      case (they should continue inside the function of the selected frame).
      
      Most of the logic of next/step/stepout would work correctly if we
      simply replaced the call to proc.topframe with something that took a
      frame index. However the breakpoint they set on the first deferred
      function is wrong, and fixing it requires scanning the defer stack and
      matching it to the call stack, something we can't do yet.
      
      Given that enhancing next/step/stepout will take time and the current
      behavior confuses users (see issue #1240) return an error if
      next/step/stepout are called while the currently selected frame isn't
      frame 0.
      
      Updates #1240
      932aad9e
    • A
      dwarf/line: remove foundFile "optimization" from LineToPC · 368cbeb0
      aarzilli 提交于
      There is no guarantee that files will end up stored contiguously in the
      debug_line section which makes this optimization wrong in the general
      case.
      In particular with recent versions of go1.11 and a go.mod file present
      the go compiler seems to sometimes produce executables that actually
      violate this assumption.
      368cbeb0
  9. 20 7月, 2018 1 次提交
  10. 14 7月, 2018 1 次提交
  11. 10 7月, 2018 2 次提交
  12. 03 7月, 2018 3 次提交
    • A
      proc: make proc.(ThreadBlockedError).Error() return a non-empty string · bdcbd8a8
      aarzilli 提交于
      The JSON-RPC layer doesn't like non-nil error that return an empty string
      when the Error method is called and when this happens it shuts down the
      connection to the server.
      Since we can return a ThreadBlockedError to the client it can't have an
      empty string as return value.
      
      Fixes #1251
      bdcbd8a8
    • P
      Handle gdb core files better · 1d8636cd
      Peter Sanford 提交于
      Core files created by gdb can have sections missing that would be
      present in OS created core files.
      
      We work around this by first reading PT_LOAD entries from the exe and
      then reading them from the core.
      
      Fixes #1121
      1d8636cd
    • A
      *: Fix log level setting in logrus · c53c43d1
      aarzilli 提交于
      Setting the Level field of a logrus logger doesn't actually do anything
      since the Level field simply reports the log level of the last log
      message emitted on the logger.
      The right way to do that is to set logger.Logger.Level.
      Also cleans up newline characters from log messages emitted through
      logrus and fixes the direction of the arrows in the messages emitted by
      rpccommon, which was inconsistent with the arrows of gdbserial.
      c53c43d1
  13. 29 6月, 2018 1 次提交
  14. 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
  15. 23 6月, 2018 1 次提交
    • A
      proc: support GNU compressed debug sections (go1.11 support) · 440b4405
      aarzilli 提交于
      Go1.11 switched to the zlib-gnu compression format for debug sections.
      Change proc and and a test in dwarf/line to support this change.
      
      Also deletes some dead code from pkg/proc/bininfo.go that hadn't been
      used in a long time.
      440b4405
  16. 22 6月, 2018 2 次提交
    • 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
    • S
      proc: add support for separate debug info · 774b5c7c
      Sergio Lopez 提交于
      To save disk space, some distributions strip the debugging information
      from the binaries, putting it in separate files, usually distributed in
      separate packages.
      
      To locate the file containing the debug information for a certain
      binary, an ELF note named ".note.gnu.build-id" is added to the latter,
      which contains a header and a build identification. This identification
      can be used to compose a path with this form:
      
      /usr/lib/debug/.build-id/BUILDID[:2]/BUILDID[2:].debug
      
      With this patch, if Delve can't find the debug information in the main
      binary, it'll try to locate and parse ".note.gnu.build-id", to compose
      and attempt to open a path with the format described above.
      
      Fixes #1206
      774b5c7c
  17. 20 6月, 2018 1 次提交
    • A
      proc,command: fix optimized function warning in 1.9 · e19cbcef
      aarzilli 提交于
      A user complained on the mailing list about having continuous
      "optimized function warnings" on non-optimized functions when using 1.9.
      This commit fixes the problem by disabling optimized function detection
      on 1.9 and earlier (where it's impossible) and adds a test so we don't
      break it again in the future.
      e19cbcef
  18. 15 6月, 2018 2 次提交
    • A
      proc: allow "package/path".varname syntax · 2a2d1040
      aarzilli 提交于
      If the application being debugged imports two packages with the same
      name (but different paths) there was no way to disambiguate the two,
      since the character '/' can not appear inside a go identifier.
      
      By allowing users to use a string literal as the package name a package
      path can be specified.
      2a2d1040
    • A
      service,logflags: log all RPC messages · 454491ce
      aarzilli 提交于
      We occasionally receive bug reports from users of VSCode-go and GoLand.
      GoLand has its own way of capturing the packet exchange between itself
      and delve but VSCode-go (supposedly) doesn't.
      So far this hasn't been a problem since all bug reports were obvious
      bugs on the plugin or easy to reproduce without VSCode-go, but it might
      be helpful in the future to have a way to log the packet exchange
      between dlv and a frontend.
      
      This commit adds a --log-output option to enable logging of all rpc
      messages and changes service/rpccommon accordingly.
      454491ce
  19. 12 6月, 2018 4 次提交
    • 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
    • A
      proc: move AllGCache to a common struct · f38a2816
      aarzilli 提交于
      Add a new method "Common" to proc.Process that returns a pointer to a
      struct that pkg/proc can use to store its things, independently of the
      backend.
      
      This is used here to replace the AllGCache typecasts, it will also be
      used to store the return values of the stepout breakpoint and the state
      for injected function calls.
      f38a2816
    • A
      proc/gdbserial: add syscall.Syscall* to list of blocking functions · d04c60e0
      aarzilli 提交于
      Fixes #1227
      d04c60e0
    • A
      proc: in go1.11 runtime.g.waitreason is not a string · 9464c237
      aarzilli 提交于
      9464c237