[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [committed mig] Do not generate code dereferencing type-punned point
From: |
David Michael |
Subject: |
Re: [committed mig] Do not generate code dereferencing type-punned pointers |
Date: |
Tue, 17 Feb 2015 23:39:46 -0500 |
On Sun, Feb 15, 2015 at 11:09 AM, Justus Winter
<4winter@informatik.uni-hamburg.de> wrote:
> * utils.c (WriteFieldDeclPrim): Generate a union with an additional
> pointer field for variable-length arrays.
This makes GDB's awk script go haywire because it doesn't know how to
deal with unions. The following is a workaround to get it building
again, but I'm not sure of its correctness. Can someone more
knowledgeable than me check on this?
Thanks.
David
--- gdb/reply_mig_hack.awk
+++ gdb/reply_mig_hack.awk
@@ -68,6 +68,11 @@
print; next;
}
+parse_phase == 4 && /^[ \t]*union {/ {
+ parse_phase = 4.5;
+ print; next;
+}
+
parse_phase == 4 {
# The value field for an argument.
arg_name[num_args] = $2;
@@ -78,6 +83,22 @@
print; next;
}
+parse_phase == 4.5 {
+ arg_name[num_args] = $2;
+ sub (/[][0-9;]*$/, "", arg_name[num_args]);
+ arg_type[num_args] = "data_t";
+ arg_name[num_args + 1] = arg_name[num_args] "Cnt";
+ arg_type[num_args + 1] = "mach_msg_type_number_t";
+ num_args += 2;
+ parse_phase = 4.6;
+ print; next;
+}
+
+parse_phase == 4.6 && /}/ {
+ parse_phase = 3;
+ print; next;
+}
+
parse_phase == 5 && /^[ \t]*(auto |static |)const mach_msg_type_t/ {
# The type check structure for an argument.
arg_check_name[num_checks] = $(NF - 2);