Browse Source

Add PAF_ARRAY_TRUNCATED flag for print_array_ex

PAF_ARRAY_TRUNCATED allows enforcing the fact that an array
is truncated, which is useful for arrays in local memory that are known
as being truncated.

* defs.h (xlat_style_private_flag_bits): Add PAF_ARRAY_TRUNCATED_BIT.
(xlat_style_private_flags): Add PAF_ARRAY_TRUNCATED.
* util.c (print_array_ex): Handle PAF_ARRAY_TRUNCATED in flags.
Eugene Syromyatnikov 4 months ago
parent
commit
bb893e87ae
2 changed files with 12 additions and 1 deletions
  1. 2
    0
      defs.h
  2. 10
    1
      util.c

+ 2
- 0
defs.h View File

@@ -765,6 +765,7 @@ sprintxval(char *buf, size_t size, const struct xlat *xlat, unsigned int val,
765 765
 enum xlat_style_private_flag_bits {
766 766
 	/* print_array */
767 767
 	PAF_PRINT_INDICES_BIT = XLAT_STYLE_SPEC_BITS + 1,
768
+	PAF_ARRAY_TRUNCATED_BIT,
768 769
 
769 770
 	/* print_xlat */
770 771
 	PXF_DEFAULT_STR_BIT,
@@ -775,6 +776,7 @@ enum xlat_style_private_flag_bits {
775 776
 enum xlat_style_private_flags {
776 777
 	/* print_array */
777 778
 	FLAG_(PAF_PRINT_INDICES),
779
+	FLAG_(PAF_ARRAY_TRUNCATED),
778 780
 
779 781
 	/* print_xlat */
780 782
 	FLAG_(PXF_DEFAULT_STR),

+ 10
- 1
util.c View File

@@ -1357,8 +1357,17 @@ print_array_ex(struct tcb *const tcp,
1357 1357
 			break;
1358 1358
 		}
1359 1359
 	}
1360
-	if (cur != start_addr)
1360
+
1361
+	if ((cur != start_addr) || !tfetch_mem_func) {
1362
+		if (flags & PAF_ARRAY_TRUNCATED) {
1363
+			if (cur != start_addr)
1364
+				tprints(", ");
1365
+
1366
+			tprints("...");
1367
+		}
1368
+
1361 1369
 		tprints("]");
1370
+	}
1362 1371
 
1363 1372
 	return cur >= end_addr;
1364 1373
 }

Loading…
Cancel
Save