-
-
Notifications
You must be signed in to change notification settings - Fork 75
Draft: Start a GDB server with --gdblisten 127.0.0.1:1337 #388
base: main
Are you sure you want to change the base?
Conversation
TODO: Turn down some warning logs TODO: Stop the GDB server when probe-run exits.
Adds separate argument/env var for GDB Server port. The default is 127.0.0.1:3333.
@@ -27,6 +27,7 @@ log = "0.4" | |||
object = { version = "0.30", default-features = false } | |||
probe-rs = "0.17" | |||
signal-hook = "0.3" | |||
gdb-server = "0.17" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep the alphabetical ordering. Makes it easier to scan through it.
/// Note: doesn't necessarily start the GDB Server. See `--gdb-on-start` and | ||
/// `--gdb-on-crash`. | ||
#[arg(long, env = "PROBE_RUN_GDB_PORT")] | ||
pub gdb_port: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered if this should be Option<SocketAddr>
instead? This will give users a suitable error message if they provide an invalid address.
$ cargo run -- --gdbport 127.0.0:3333
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target/debug/krate --gdbport '127.0.0:3333'`
error: invalid value '127.0.0:3333' for '--gdbport <GDBPORT>': invalid socket address syntax
For more information, try '--help'.
But, since GdbInstanceConfiguration::from_session
takes a Option<impl Into<String>>
, I am unsure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea. We can always turn the valid socket address back into a string before giving it to the GDB server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we should warn if they provide a gdb-port but fail to activate either of the GDB options (-on-start or -on-fault)
TODO: