Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bridge: debug: Always try to exit debug first #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/bridge/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ int debug_enter(struct debug *ctx)

logi("Entering debug mode\n");

// Blindly try to exit debug mode first
rc = console_set_baud(ctx->console, 115200);
if (rc < 0)
return rc;

// Escape character should cancel previous commands
// q will exit debug mode
rc = prompt_write(&ctx->prompt, "\x1Bq\r\n\x1Bq\r\n", strlen("\x1Bq\r\n\x1Bq\r\n"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I was trying to avoid injecting things into the BMC console if I could help it. Maybe we could add this behind a --recover or --force-quit option so we can at least control when it is run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, yup... But now we have that problem with the command line argument parsing again 😄
Would you implement this as a flag in the main culvert.c getopt()?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's a fair criticism :D Maybe let's leave this to lie for a bit, I'm thinking about what we can do to improve the command line parsing experience.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does anyone object if I cherry-pick this patchset to #73 to improve the argument parsing with my ongoing changes? ^^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially if you give it a new CLI flag, absolutely, please! 😃

if (rc < 0)
return rc;

// Enter debug mode
rc = console_set_baud(ctx->console, 1200);
if (rc < 0)
return rc;
Expand Down
Loading