[Crash-utility] [PATCH v4 04/12] Fix lack of information about struct members and unionprint

Alexey Makhalov amakhalov at vmware.com
Sat Mar 20 04:07:28 UTC 2021


It is regression after gdb-10 update caused by memory corruption by
using incorrect pointer sizes.

Crash has pointers for the set of prettyprint variables in gdb.
Their type was changed from integer (in gdb-7.6) to bool (in gdb-10).

Update pointer types from the crash side accordingly.

Signed-off-by: Alexey Makhalov <amakhalov at vmware.com>
Reported-by: Kazuhito Hagio <k-hagio-ab at nec.com>
---
 defs.h          |  8 ++++----
 gdb_interface.c | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/defs.h b/defs.h
index 241ee24..4434453 100644
--- a/defs.h
+++ b/defs.h
@@ -7026,10 +7026,10 @@ void gdb_readnow_warning(void);
 int gdb_set_crash_scope(ulong, char *);
 extern int *gdb_output_format;
 extern unsigned int *gdb_print_max;
-extern int *gdb_prettyprint_structs;
-extern int *gdb_prettyprint_arrays;
-extern int *gdb_repeat_count_threshold;
-extern int *gdb_stop_print_at_null;
+extern unsigned char *gdb_prettyprint_structs;
+extern unsigned char *gdb_prettyprint_arrays;
+extern unsigned int *gdb_repeat_count_threshold;
+extern unsigned char *gdb_stop_print_at_null;
 extern unsigned int *gdb_output_radix;
 
 /*
diff --git a/gdb_interface.c b/gdb_interface.c
index 194082f..480a80b 100644
--- a/gdb_interface.c
+++ b/gdb_interface.c
@@ -26,10 +26,10 @@ int get_frame_offset(ulong);
 
 int *gdb_output_format;
 unsigned int *gdb_print_max;
-int *gdb_prettyprint_structs;
-int *gdb_prettyprint_arrays;
-int *gdb_repeat_count_threshold;
-int *gdb_stop_print_at_null;
+unsigned char *gdb_prettyprint_structs;
+unsigned char *gdb_prettyprint_arrays;
+unsigned int *gdb_repeat_count_threshold;
+unsigned char *gdb_stop_print_at_null;
 unsigned int *gdb_output_radix;
 static void gdb_error_debug(void);
 
@@ -195,13 +195,13 @@ gdb_session_init(void)
 		gdb_user_print_option_address("output_format");
 	gdb_print_max = (unsigned int *)
 		gdb_user_print_option_address("print_max");
-	gdb_prettyprint_structs = (int *)
+	gdb_prettyprint_structs = (unsigned char *)
 		gdb_user_print_option_address("prettyprint_structs");
-	gdb_prettyprint_arrays = (int *)
+	gdb_prettyprint_arrays = (unsigned char *)
 		gdb_user_print_option_address("prettyprint_arrays");
-	gdb_repeat_count_threshold = (int *)
+	gdb_repeat_count_threshold = (unsigned int *)
 		gdb_user_print_option_address("repeat_count_threshold");
-	gdb_stop_print_at_null = (int *)
+	gdb_stop_print_at_null = (unsigned char *)
 		gdb_user_print_option_address("stop_print_at_null");
 	gdb_output_radix = (unsigned int *)
 		gdb_user_print_option_address("output_radix");
-- 
2.11.0




More information about the Crash-utility mailing list