Parcourir la source

Fix format warning by PRIu32 in [wasm|aot] dump call stack (#2251)

Huang Qi il y a 2 ans
Parent
commit
7ec77598dd
3 fichiers modifiés avec 13 ajouts et 8 suppressions
  1. 1 0
      .gitignore
  2. 6 4
      core/iwasm/aot/aot_runtime.c
  3. 6 4
      core/iwasm/interpreter/wasm_runtime.c

+ 1 - 0
.gitignore

@@ -1,4 +1,5 @@
 .cache
+.clangd
 .vs
 .vscode
 .venv

+ 6 - 4
core/iwasm/aot/aot_runtime.c

@@ -2797,12 +2797,14 @@ aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len)
 
         /* function name not exported, print number instead */
         if (frame.func_name_wp == NULL) {
-            line_length = snprintf(line_buf, sizeof(line_buf), "#%02d $f%d\n",
-                                   n, frame.func_index);
+            line_length =
+                snprintf(line_buf, sizeof(line_buf),
+                         "#%02" PRIu32 " $f%" PRIu32 "\n", n, frame.func_index);
         }
         else {
-            line_length = snprintf(line_buf, sizeof(line_buf), "#%02d %s\n", n,
-                                   frame.func_name_wp);
+            line_length =
+                snprintf(line_buf, sizeof(line_buf), "#%02" PRIu32 " %s\n", n,
+                         frame.func_name_wp);
         }
 
         if (line_length >= sizeof(line_buf)) {

+ 6 - 4
core/iwasm/interpreter/wasm_runtime.c

@@ -3048,12 +3048,14 @@ wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env, bool print, char *buf,
 
         /* function name not exported, print number instead */
         if (frame.func_name_wp == NULL) {
-            line_length = snprintf(line_buf, sizeof(line_buf), "#%02d $f%d\n",
-                                   n, frame.func_index);
+            line_length =
+                snprintf(line_buf, sizeof(line_buf),
+                         "#%02" PRIu32 " $f%" PRIu32 "\n", n, frame.func_index);
         }
         else {
-            line_length = snprintf(line_buf, sizeof(line_buf), "#%02d %s\n", n,
-                                   frame.func_name_wp);
+            line_length =
+                snprintf(line_buf, sizeof(line_buf), "#%02" PRIu32 " %s\n", n,
+                         frame.func_name_wp);
         }
 
         if (line_length >= sizeof(line_buf)) {