mono / sdb

A command line client for the Mono soft debugger.
https://www.mono-project.com
MIT License
116 stars 44 forks source link

Using sdb with Emacs GUD #35

Closed krgn closed 7 years ago

krgn commented 7 years ago

Hi,

I would like to use sdb together with Emacs (25.1.1) in GUD mode. When I run sdb on the command line, the debugger starts up fine. However, when I start GUD with sdb as command, I see the following exception:

Welcome to the Mono soft debugger (sdb 1.5.6151.25963)
Type 'help' for a list of commands or 'quit' to exit

(sdb)  
Unhandled Exception:
System.DivideByZeroException: Attempted to divide by zero.
  at Mono.Terminal.LineEditor.UpdateHomeRow (System.Int32 screenpos) [0x00007] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Render () [0x00091] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.InitText (System.String initial) [0x00023] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Edit (System.String prompt, System.String initial) [0x0004a] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.CommandLine.Run (System.Version ver, System.Boolean batch, System.Boolean rc, System.Collections.Generic.IEnumerable`1[T] commands, System.Collections.Generic.IEnumerable`1[T] files) [0x00188] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.Program.Main (System.String[] args) [0x0014c] in <a502775e267945eaa32716c6aef8ad60>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DivideByZeroException: Attempted to divide by zero.
  at Mono.Terminal.LineEditor.UpdateHomeRow (System.Int32 screenpos) [0x00007] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Render () [0x00091] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.InitText (System.String initial) [0x00023] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Terminal.LineEditor.Edit (System.String prompt, System.String initial) [0x0004a] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.CommandLine.Run (System.Version ver, System.Boolean batch, System.Boolean rc, System.Collections.Generic.IEnumerable`1[T] commands, System.Collections.Generic.IEnumerable`1[T] files) [0x00188] in <a502775e267945eaa32716c6aef8ad60>:0 
  at Mono.Debugger.Client.Program.Main (System.String[] args) [0x0014c] in <a502775e267945eaa32716c6aef8ad60>:0 

Debugger exited abnormally with code 1

Unfortunately, there is not much information out there documenting this setup. Is there any way to make sbd and Emacs play nice with each other?

Thanks,

Karsten

alexrp commented 7 years ago

SDB only falls back to Mono.Terminal.LineEditor if libedit.so.2 can't be found. So I would suggest making sure you have it installed. It's more likely to play nice with Emacs than Mono.Terminal.LineEditor.

krgn commented 7 years ago

@alexrp thank you, that solved the problem!

nosami commented 7 years ago

@krgn Do you have any emacs config needed for this? I've been meaning to get this set up for ages but never got around to it.

krgn commented 7 years ago

@nosami not yet :)

I only got sdb to build on NixOS today, so I have just been running M-x sdb and that's it. Would be cool to have it nicely integrated with fsharp-mode eventually!

nosami commented 7 years ago

Yeah.. I did look into how other debuggers were set up with GUD around a couple of years ago but gave up on it. Happy to share efforts on this.

krgn commented 7 years ago

I'll look at how this works later tonight. Might not be all that hard, now that it doesn't crash on me anymore.

krgn commented 7 years ago

@nosami it seems like defining commands to send to the debugger is quite easy, but I there are many details that I have no clue how they work (fringe bp's for instance). This discussion should probably happen somewhere else though :)