Commit 9f46367
committed
pbdrv/uart_debug_first_port: Log on panic.
It's helpful when you crash to see what happens right before you
crash. For example, if you add a log message "about to dereference
sketchy pointer" and then you get a segfault, you'd love to know
whether that message occurred. This change makes it so that at least
on EV3, we will.
This also adds "pb_log" as an alias for pbdrv_uart_debug_printf.
Usually, platforms make it easy to log debug messages, and we should
be no different. C.f. `ESP_LOGI`, Zephyr's `LOG_ERR`, glog's
`LOG(WARNING)` etc.
Tested by adding the following code to pbdrv_init.
```
pb_log("test\n");
lwrb_t* rb = (lwrb_t*)0x1281441490;
pb_log("%p\n", lwrb_get_free(rb));
```
Before this, the "test" would not appear before the panic.
After, it does. If a panic occurs while some messages are pending
in the uart send state, some bytes may be duplicated on the log.1 parent 350db6e commit 9f46367
File tree
3 files changed
+31
-0
lines changed- lib/pbio
- drv/uart
- platform/ev3
3 files changed
+31
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
| |||
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
33 | 45 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
446 | 453 | | |
447 | 454 | | |
448 | 455 | | |
| |||
0 commit comments