mono / sdb

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

Readline() not work well (sdb plugin) #46

Closed callmekohei closed 6 years ago

callmekohei commented 6 years ago

Hello! I'm callmekohei!

screen shot 2018-01-13 at 14 44 25

Problesm

Readline() not work well.

like this

(sdb) mycmd foo.exe
....
(sdb)                  // <--- I can not watch input strings (^_^;;;

repro

  1. wirte code
    
    open Mono.Debugger.Client
    open Mono.Debugging.Client

open System.IO

[<Sealed; Command>] type MyCommand() = inherit Command() override .Names = [|"mycmd"|] override .Summary = "aaa bbb ccc" override .Syntax = "ddd eee fff" override .Help = "Help Help Help" override __.Process(args) =

    let file = new FileInfo(args)
    Debugger.Run(file)

    let width = System.Console.WindowWidth
    Log.Info(String.replicate width "─" )

02 compile and move dll

$ fsharpc -a -r:$(dirname $(which sdb))/../lib/sdb/sdb.exe test.fsx $ mv test.dll ../.sdb/


03 launch sdb and run

$ sdb (sdb) mycmd foo.exe ... (sdb) // <--- I can not watch input strings (^_^;;;

callmekohei commented 6 years ago

work around

add following

let ps = new System.Diagnostics.Process()
ps.StartInfo.FileName <- "/bin/stty"
ps.StartInfo.Arguments <- "echo"
ps.Start() |> ignore
Log.Info(string(ps.Id))
()
callmekohei commented 6 years ago

Hello! I'm callmekohei!

Solved! (^_^)b

It's need to sleep time ( 5ms ).

open Mono.Debugger.Client
open Mono.Debugging.Client

open System.IO

[<Sealed; Command>]
type MyCommand() =
    inherit Command()
    override __.Names   = [|"mycmd"|]
    override __.Summary = "aaa bbb ccc"
    override __.Syntax  = "ddd eee fff"
    override __.Help    = "Help Help Help"
    override __.Process(args) =

        let file = new FileInfo(args)
        Debugger.Run(file)

        let width = System.Console.WindowWidth
        Log.Info(String.replicate width "─" )

        Process.Start("stty","echo")
        System.Threading.Thread.Sleep 5
        ()

Thanks (^_^)/