Skip to content

Instantly share code, notes, and snippets.

@scottcarr
Created October 4, 2017 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottcarr/e9605a0b4c058f4e853b0ac11f1a3abe to your computer and use it in GitHub Desktop.
Save scottcarr/e9605a0b4c058f4e853b0ac11f1a3abe to your computer and use it in GitHub Desktop.
#lang racket
(define GDB-PROMPT #"(gdb) \n")
(define NEWLINE 10)
(define-values (proc o i e) (subprocess #f #f #f "/usr/bin/gdb" "--interpreter=mi2"))
(file-stream-buffer-mode o 'none)
(file-stream-buffer-mode i 'none)
(file-stream-buffer-mode e 'none)
; read menu (10 lines long)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
(read-bytes-line o)
; read (gdb) \n
(read-bytes-line o)
(write-bytes #"-exec-run\n" i)
(flush-output i)
(sleep 1)
(read-bytes-line o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment