-
-
Notifications
You must be signed in to change notification settings - Fork 773
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
Fix: -Wformat in gdbserver (gdb_main, command, gdb_hostio) #1676
Conversation
5eef6b0
to
be980e2
Compare
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.
There are a couple of items picked up in review, but with them taken care of this is looking excellent and we'll be happy to merge it. Once it is, we'll take a look at the tc_printf() side of this as that'd be a nice thing to get ironed out
d81f6a5
to
72adeec
Compare
The purpose of "mon heapinfo" is setting values for newlib/libc/sys/arm/crt0.S to pick up. If changing to %x saves a few bytes, fine. If wishing to save more bytes, perhaps:
|
Ahh, that's good to know why it exists - perhaps that could be added as a comment in the code documenting its purpose and function + what it interfaces with? It's not currently obvious or noted anywhere in the source. |
@dragonmux @koendv As enabling attribute format for
No need to drop existing tested proved working functionality. It can also decouple me from the authors who touched that code, if Koen is okay with dedicating some time to fixing printf-correctness in heapinfo (and probably RTT). |
heapinfo can be used to quickly test a system with different heap and stack values, to see how much heap and stack is needed.
The code in arm/crt0.S is conditionally compiled #ifdef ARM_RDI_MONITOR. I think the "heapinfo" command is a good candidate for adding to the 2.0 build system. How about "#ifdef ENABLE_HEAPINFO", with default of 0? |
Have taken a look, will make PR. |
That'd be a KConfig style option and we're not yet sure what the macro format for those is going to look like exactly - the ENABLE_ macros we introduced are placeholders to make things work in the current build system. We're not certain turning this command off in some builds is going to be a good idea over just.. documenting what it exists for in the source. Perhaps though - needs some careful thought and consultation with Esden before we can give a firm direction. |
ok. done, 60 bytes saved in heapinfo, 66 bytes saved in rtt. |
72adeec
to
678228a
Compare
Thank you very much. Rebased this PR branch on main (by cherry-picking), omitted / rebased away the two rtt/heapinfo draft commits as dealt separately in dedicated PRs. |
74449ba
to
9740900
Compare
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.
Looks like all the big review items have been solved. We spotted one mistake in this round, a simple x
vs X
issue in gdb_main.c, but with that fixed we think this is ready for merge.
9740900
to
c80b121
Compare
Even though I briefly tested these two PRs combined, I strongly recommend merging #1686 first, so that PRIx32 impact can be tested/measured on an actually working in-BMP implementation. |
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.
LGTM, we'll merge this after #1686 as suggested as we agree on that order of operations point for testing.
c80b121
to
b1879f9
Compare
b1879f9
to
6686719
Compare
* %08PRIX32 for uint32_t/target_addr_t, %l for long * Cast any size_t to uint32_t and use %08X (as PRIX32) for them
6686719
to
3758de6
Compare
Rebased away the FIXME comments I left in headers; and rephrased the latest commit message to stay under 70 characters limit of most Git UIs. I don't follow the 50/72 rule (yet), but especially GitHub web interface likes to mangle long subjects. |
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.
Excellent, we'll get this merged then. Thank you for all your hard work and the contribution!
Detailed description
I deal here only with
gdb_voutf()
andgdb_putpacket_f()
, as their direct usage (with dubious specificators, specifically) is less numerous. Let someone else deal with all thetc_printf()
.I am build-testing the changes for
native
on Linux amd64, and forswlink
which is armv7-m. Runtime testing pending -- there is no code coverage tooling, so I have to reason about which aspects need testing, like GDB remote monitor commands for rtt options and semihosting heapinfo.Your checklist for this pull request
make PROBE_HOST=native
)make PROBE_HOST=hosted
)Closing issues
Partially fixes #1675. See that for a more detailed description.