west: runners: openocd: debug: add log file support#108806
Conversation
Use OpenOCD feature to use a log file instead of printing the logs out, which west does not show. This permits accessing the OpenOCD logs at all which are not shown otherwise. Signed-off-by: Josuah Demangeon <me@josuah.net>
|
pdgendt
left a comment
There was a problem hiding this comment.
I'm surprised the OpenOCD runner doesn't simply support the tool_opt arguments? This would've allowed to pass in any argument to the OpenOCD command.
Should there still be an explicit I can open a new PR or modify the current one, as is best. |
Are you saying something somewhere captures OpenOCD logs and then drops them on the floor? That sounds like a serious design bug worth filing. If correct, then this PR is a useful mitigation worth merging but not a fix yet. At worst, too verbose logs that cannot be turned off should be buried in some log file in some possibly obscure, default location. But never discarded. |
Also, I'm afraid I'm missing the connection with this PR. |
Yes, this is probably related to GDB taking over stdio for terminal UI, and OpenOCD "polluting" this with logs. 4d1d8a7 Good for day-to-day use, but difficult for debugging anything.
I was only thinking how to have the same "use this file for log output" flag for all runners. |
Sorry for insisting but you sound like you know more than enough to describe this in a new GH issue. Would you mind? It does not have to be long or "the perfect bug", far from it. Hey, it might even be quickly closed as "too difficult, wontfix" but that would still be a useful place to record this design problem. Then a source comment in this PR pointing at this new issue would be perfect. |
| self.print_gdbserver_message() | ||
|
|
||
| if command in ('attach', 'debug'): | ||
| server_proc = self.popen_ignore_int(server_cmd, stderr=subprocess.DEVNULL) |
There was a problem hiding this comment.
This is where the logs are discarded AFAIU
|
Thanks @josuah for filing #108961! After gathering more context, I think these logs should be always redirected to some temporary file. Then, this new EDIT: or, it could just be some hardcoded location the build directory. Probably simpler. |



Use OpenOCD feature to use a log file instead of printing the logs out, which west does not show.
This permits accessing the OpenOCD logs at all which are not shown otherwise.
$ west debug --log-file asdf.log$ cat asdf.logcc:
--tuioption #81405