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

Updated dissasm view: fixed offsets and added caching + some misc improvements #351

Merged
merged 9 commits into from
Oct 26, 2024

Conversation

rzaharia
Copy link
Collaborator

  • fixed Dissasm bug when some offsets would be shown incorrectly
  • added caching file for Dissasm where it stores comments and annotations

@rzaharia rzaharia added Bug Something isn't working Enhancement New feature or request labels Oct 26, 2024
@rzaharia rzaharia self-assigned this Oct 26, 2024
@rzaharia rzaharia changed the title Updated dissasm view: fixed offsets and added caching Updated dissasm view: fixed offsets and added caching + some misc improvements Oct 26, 2024
@rzaharia rzaharia merged commit c9d0135 into main Oct 26, 2024
5 checks passed
const auto* dissasmZone = (DissasmCodeZone*) zone.get();
if (!dissasmZone->ToBuffer(buffer))
return;
zoneName.SetFormat("DissasmParseZoneType.%llu", zone->startLineIndex);

Check failure

Code scanning / CodeQL

Wrong type of arguments to formatting function High

This format specifier for type 'unsigned long long' does not match the argument type 'unsigned int'.

Copilot Autofix AI 29 days ago

To fix the problem, we need to ensure that the format specifier matches the type of the variable being formatted. Since startLineIndex is of type unsigned int, the correct format specifier should be %u instead of %llu.

  • Change the format specifier in the SetFormat method call from %llu to %u to match the unsigned int type of startLineIndex.
  • This change should be made in the file GViewCore/src/View/DissasmViewer/DissasmCache.cpp on line 170.
Suggested changeset 1
GViewCore/src/View/DissasmViewer/DissasmCache.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/GViewCore/src/View/DissasmViewer/DissasmCache.cpp b/GViewCore/src/View/DissasmViewer/DissasmCache.cpp
--- a/GViewCore/src/View/DissasmViewer/DissasmCache.cpp
+++ b/GViewCore/src/View/DissasmViewer/DissasmCache.cpp
@@ -169,3 +169,3 @@
             return;
-        zoneName.SetFormat("DissasmParseZoneType.%llu", zone->startLineIndex);
+        zoneName.SetFormat("DissasmParseZoneType.%u", zone->startLineIndex);
         if (!cacheData.AddRegion(zoneName.GetText(), buffer.data(), (uint32) buffer.size()))
@@ -185,3 +185,3 @@
             return false;
-        zoneName.SetFormat("DisassemblyZone.%llu", start);
+        zoneName.SetFormat("DisassemblyZone.%u", start);
         if (!cache.AddRegion(zoneName.GetText(), buffer.data(), (uint32) buffer.size()))
EOF
@@ -169,3 +169,3 @@
return;
zoneName.SetFormat("DissasmParseZoneType.%llu", zone->startLineIndex);
zoneName.SetFormat("DissasmParseZoneType.%u", zone->startLineIndex);
if (!cacheData.AddRegion(zoneName.GetText(), buffer.data(), (uint32) buffer.size()))
@@ -185,3 +185,3 @@
return false;
zoneName.SetFormat("DisassemblyZone.%llu", start);
zoneName.SetFormat("DisassemblyZone.%u", start);
if (!cache.AddRegion(zoneName.GetText(), buffer.data(), (uint32) buffer.size()))
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
if (zoneType != DissasmParseZoneType::DissasmCodeParseZone)
return false;
LocalString<64> zoneName;
zoneName.SetFormat("DissasmParseZoneType.%llu", startLineIndex);

Check failure

Code scanning / CodeQL

Wrong type of arguments to formatting function High

This format specifier for type 'unsigned long long' does not match the argument type 'unsigned int'.

Copilot Autofix AI 29 days ago

To fix the problem, we need to ensure that the format specifier matches the type of startLineIndex. Since startLineIndex is of type unsigned int, the correct format specifier to use is %u. This change will ensure that the printf function interprets the argument correctly, preventing any undefined behavior.

Suggested changeset 1
GViewCore/src/View/DissasmViewer/DissasmCache.cpp

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/GViewCore/src/View/DissasmViewer/DissasmCache.cpp b/GViewCore/src/View/DissasmViewer/DissasmCache.cpp
--- a/GViewCore/src/View/DissasmViewer/DissasmCache.cpp
+++ b/GViewCore/src/View/DissasmViewer/DissasmCache.cpp
@@ -258,3 +258,3 @@
     LocalString<64> zoneName;
-    zoneName.SetFormat("DissasmParseZoneType.%llu", startLineIndex);
+    zoneName.SetFormat("DissasmParseZoneType.%u", startLineIndex);
 
EOF
@@ -258,3 +258,3 @@
LocalString<64> zoneName;
zoneName.SetFormat("DissasmParseZoneType.%llu", startLineIndex);
zoneName.SetFormat("DissasmParseZoneType.%u", startLineIndex);

Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants