Skip to content

Fix fmt-style LogError/LogInfo calls to use proper printf-style format strings#847

Merged
xusheng6 merged 3 commits intodevfrom
copilot/fix-846
Sep 23, 2025
Merged

Fix fmt-style LogError/LogInfo calls to use proper printf-style format strings#847
xusheng6 merged 3 commits intodevfrom
copilot/fix-846

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 23, 2025

The LogError and LogInfo functions expect printf-style format strings (using %s, %d, etc. placeholders) but were being called with fmt-style format strings (using {} placeholders) in several locations, causing the formatting to fail.

This PR fixes 8 problematic calls across 2 files by wrapping the fmt-style strings with fmt::format() and passing them to LogError/LogInfo via %s, following the existing pattern established in cli/main.cpp:382.

Changes made:

In core/debuggercontroller.cpp:

  • Fixed 6 LogError calls in file I/O operations for code coverage functionality
  • Fixed 1 LogInfo call for loading code coverage data

In core/adapters/dbgengttdadapter.cpp:

  • Fixed 1 LogError call for TTD position navigation failures
  • Fixed 1 LogInfo call for successful TTD position navigation

Before:

LogError("Error saving code coverage: {}", e.what());
LogInfo("Loaded {} executed instruction addresses from {}", count, filePath.c_str());

After:

LogError("%s", fmt::format("Error saving code coverage: {}", e.what()).c_str());
LogInfo("%s", fmt::format("Loaded {} executed instruction addresses from {}", count, filePath.c_str()).c_str());

All existing printf-style LogError/LogInfo calls remain unchanged. The fix ensures proper string formatting while maintaining the benefits of fmt-style formatting through the fmt::format() wrapper.

Fixes #846.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…t strings

Co-authored-by: xusheng6 <94503187+xusheng6@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Sep 23, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ xusheng6
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix fmt style LogError/LogInfo Fix fmt-style LogError/LogInfo calls to use proper printf-style format strings Sep 23, 2025
Copilot AI requested a review from xusheng6 September 23, 2025 04:45
@xusheng6 xusheng6 marked this pull request as ready for review September 23, 2025 04:50
@xusheng6 xusheng6 merged commit 2797459 into dev Sep 23, 2025
1 check was pending
@xusheng6 xusheng6 deleted the copilot/fix-846 branch September 23, 2025 04:50
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

Successfully merging this pull request may close these issues.

Fix fmt style LogError/LogInfo

3 participants