X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Freply_mig_hack.awk;h=2c2a30a50d4b34118568e2f2e8898fe5a4776c11;hb=b1a921c8c6f9e3d033629f32473c6470c360b43f;hp=b41f50823f05b01461c98e3178259d0b74669368;hpb=ed288bb597072176e84fc8279707a3f2f475779b;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/reply_mig_hack.awk b/gdb/reply_mig_hack.awk index b41f50823f..2c2a30a50d 100644 --- a/gdb/reply_mig_hack.awk +++ b/gdb/reply_mig_hack.awk @@ -1,12 +1,12 @@ # Reply server mig-output massager # -# Copyright (C) 1995 Free Software Foundation, Inc. +# Copyright (C) 1995-2015 Free Software Foundation, Inc. # # Written by Miles Bader # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2, or (at +# published by the Free Software Foundation; either version 3, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,8 +15,7 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program. If not, see . # # This awk script hacks the output of mig-generated reply server code # so that it allows replies with just the error-code in them (as this is @@ -79,9 +78,9 @@ parse_phase == 4 { print; next; } -parse_phase == 5 && /^[ \t]*static const mach_msg_type_t/ { +parse_phase == 5 && /^[ \t]*(auto |static |)const mach_msg_type_t/ { # The type check structure for an argument. - arg_check_name[num_checks] = $4; + arg_check_name[num_checks] = $(NF - 2); num_checks++; print; next; } @@ -93,6 +92,12 @@ parse_phase == 5 && /^[ \t]*mig_external kern_return_t/ { } parse_phase == 5 && /^#if[ \t]TypeCheck/ { + # Keep going if we have not yet collected the type check structures. + if (num_checks == 0) + { + print; next; + } + # The first args type checking statement; we need to insert our chunk of # code that bypasses all the type checks if this is an error return, after # which we're done until we get to the next function. Handily, the size @@ -100,7 +105,7 @@ parse_phase == 5 && /^#if[ \t]TypeCheck/ { # structure that we want to check for. print "\tif (In0P->Head.msgh_size == sizeof (Reply)"; print "\t && ! (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)"; - print "\t && *(int *)&In0P->" arg_type_code_name[0] " == *(int *)&" arg_check_name[0]; + print "\t && ! BAD_TYPECHECK(&In0P->" arg_type_code_name[0] ", &" arg_check_name[0] ")"; print "\t && In0P->" arg_name[0] " != 0)"; print "\t /* Error return, only the error code argument is passed. */"; print "\t {";