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

Chapter 5.3: unexpected SIGINTs in gdb on M1 Mac #517

Open
arr-ee opened this issue Mar 12, 2023 · 5 comments
Open

Chapter 5.3: unexpected SIGINTs in gdb on M1 Mac #517

arr-ee opened this issue Mar 12, 2023 · 5 comments

Comments

@arr-ee
Copy link
Contributor

arr-ee commented Mar 12, 2023

I am not sure if this causes any actual issues as of right now, so this might be mostly to get pointers for further digging.

When going through the Debug it section, I'm seeing

a) unexpected SIGINT right after break main
b) SIGINT when reaching line 16 (== loop {})

I also noticed that if I start stepi after breaking on break main, I get SIGINT after every command.

Full GDB session:

❯ arm-none-eabi-gdb target/thumbv7em-none-eabihf/debug/led-roulette
GNU gdb (Arm GNU Toolchain 12.2 (Build arm-12.24)) 12.1.90.20221210-git
...
This GDB was configured as "--host=aarch64-apple-darwin20.6.0 --target=arm-none-eabi".
Reading symbols from target/thumbv7em-none-eabihf/debug/led-roulette...
(gdb) target remote :1337
Remote debugging using :1337
0x00000100 in nrf52833_pac::{impl#280}::fmt (self=0x281a7e10, f=0x9f867a82) at src/lib.rs:163
163	#[derive(Copy, Clone, Debug, PartialEq, Eq)]
(gdb) b main
Breakpoint 1 at 0x15c: file src/05-led-roulette/src/main.rs, line 9.
Note: automatically using hardware breakpoints for read-only addresses.
(gdb) c
Continuing.

Breakpoint 1, led_roulette::__cortex_m_rt_main_trampoline () at src/05-led-roulette/src/main.rs:9
9	#[entry]
(gdb) info thread
  Id   Target Id         Frame
* 1    Thread 1.1 (main) led_roulette::__cortex_m_rt_main_trampoline () at src/05-led-roulette/src/main.rs:9
(gdb) b 13
Breakpoint 2 at 0x168: file src/05-led-roulette/src/main.rs, line 13.
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
led_roulette::__cortex_m_rt_main () at src/05-led-roulette/src/main.rs:10
10	fn main() -> ! {
(gdb) c
Continuing.

Breakpoint 2, led_roulette::__cortex_m_rt_main () at src/05-led-roulette/src/main.rs:13
13	    _y = x;
(gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
led_roulette::__cortex_m_rt_main () at src/05-led-roulette/src/main.rs:16
16	    loop {}

Environment:

  • ❯ sw_vers -productVersion: 13.2.1
  • ❯ rustc -V: rustc 1.68.0 (2c8cc3432 2023-03-06)
  • ❯ cargo embed --version: cargo embed 0.16.0 (also tried with Add support for monitor reset and monitor reset halt commands probe-rs/probe-rs#1565 based off current master)
  • ❯ arm-none-eabi-gdb --version: GNU gdb (Arm GNU Toolchain 12.2 (Build arm-12.24)) 12.1.90.20221210-git
  • microbit v2.21
  • flashing command: cargo embed --target thumbv7em-none-eabihf --features v2
@arr-ee
Copy link
Contributor Author

arr-ee commented Mar 12, 2023

I’m happy to dig further, but so far I was unable to understand where that message is even coming from — most of my experience with GDB came from couple of hours of reading while debugging this and #515 :)

@arr-ee
Copy link
Contributor Author

arr-ee commented Mar 12, 2023

probe-rs/probe-rs#1235 points out that microbit v2.20/v2.21 use different interface chip, and it seems like it might behave slightly differently from v2.0. I have not looked into validating this hunch but leaving the link here just in case.

@margaretdax
Copy link
Contributor

Also running into this on M1 mac. Seems like it's behaving fine other than the message printing out in gdb.

@CarlosLaraFP
Copy link

Running into this same issue.

@rodneylab
Copy link

I had this issue too. The folks in the Rust Embedded Matrix room took a look, and could not see why it happens. However, you can just type continue in GDB, when you get the SIGINT, and carry on with the chapter. They suggested using defmt with probe-rs for debugging embedded Rust code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants