From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12889 invoked by alias); 16 Feb 2011 21:31:57 -0000 Received: (qmail 12878 invoked by uid 22791); 16 Feb 2011 21:31:56 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 16 Feb 2011 21:31:51 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1GLVolr031014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Feb 2011 16:31:50 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1GLVnqb019059; Wed, 16 Feb 2011 16:31:50 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p1GLVnXH030931; Wed, 16 Feb 2011 16:31:49 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id C9AA2378CAD; Wed, 16 Feb 2011 14:31:48 -0700 (MST) From: Tom Tromey To: gdb-patches@sourceware.org Subject: FYI: tweaks to error w/ unimplemented opcodes Date: Wed, 16 Feb 2011 21:36:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00391.txt.bz2 I'm checking this in. I wanted to make the 'default' case in compile_dwarf_to_ax call 'unimplemented'. While looking at this I decided that my old patch to add a 'def' argument to dwarf_stack_op_name was a bad idea, so I backed that out and changed the callers to do the right thing: print the opcode name if available, and the hex value if not. Built and regtested on x86-64 (compile farm). Tom 2011-02-16 Tom Tromey * dwarf2loc.c (unimplemented): Handle unnamed opcodes. (compile_dwarf_to_ax) : Use unimplemented. : Update. (disassemble_dwarf_expression): Update. * dwarf2read.c (dwarf_stack_op_name): Remove 'def' argument. (decode_locdesc): Update. * dwarf2expr.h (dwarf_stack_op_name): Update. Index: dwarf2expr.h =================================================================== RCS file: /cvs/src/src/gdb/dwarf2expr.h,v retrieving revision 1.30 diff -u -r1.30 dwarf2expr.h --- dwarf2expr.h 1 Jan 2011 15:33:02 -0000 1.30 +++ dwarf2expr.h 16 Feb 2011 21:28:09 -0000 @@ -229,7 +229,7 @@ const gdb_byte *read_sleb128 (const gdb_byte *buf, const gdb_byte *buf_end, LONGEST * r); -const char *dwarf_stack_op_name (unsigned int, int); +const char *dwarf_stack_op_name (unsigned int); void dwarf_expr_require_composition (const gdb_byte *, const gdb_byte *, const char *); Index: dwarf2loc.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2loc.c,v retrieving revision 1.104 diff -u -r1.104 dwarf2loc.c --- dwarf2loc.c 14 Feb 2011 11:21:25 -0000 1.104 +++ dwarf2loc.c 16 Feb 2011 21:28:10 -0000 @@ -1334,8 +1334,14 @@ static void unimplemented (unsigned int op) { - error (_("DWARF operator %s cannot be translated to an agent expression"), - dwarf_stack_op_name (op, 1)); + const char *name = dwarf_stack_op_name (op); + + if (name) + error (_("DWARF operator %s cannot be translated to an agent expression"), + name); + else + error (_("Unknown DWARF operator 0x%02x cannot be to an agent expression"), + op); } /* A helper function to convert a DWARF register to an arch register. @@ -1793,8 +1799,10 @@ ax_simple (expr, aop_ref64); break; default: + /* Note that dwarf_stack_op_name will never return + NULL here. */ error (_("Unsupported size %d in %s"), - size, dwarf_stack_op_name (op, 1)); + size, dwarf_stack_op_name (op)); } } break; @@ -2070,7 +2078,7 @@ unimplemented (op); default: - error (_("Unhandled dwarf expression opcode 0x%x"), op); + unimplemented (op); } } @@ -2295,7 +2303,7 @@ LONGEST l; const char *name; - name = dwarf_stack_op_name (op, 0); + name = dwarf_stack_op_name (op); if (!name) error (_("Unrecognized DWARF opcode 0x%02x at %ld"), Index: dwarf2read.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2read.c,v retrieving revision 1.499 diff -u -r1.499 dwarf2read.c --- dwarf2read.c 8 Feb 2011 13:30:08 -0000 1.499 +++ dwarf2read.c 16 Feb 2011 21:28:11 -0000 @@ -12497,7 +12497,7 @@ /* Convert a DWARF stack opcode into its string name. */ const char * -dwarf_stack_op_name (unsigned op, int def) +dwarf_stack_op_name (unsigned op) { switch (op) { @@ -12819,7 +12819,7 @@ case DW_OP_GNU_implicit_pointer: return "DW_OP_GNU_implicit_pointer"; default: - return def ? "OP_" : NULL; + return NULL; } } @@ -13743,8 +13743,17 @@ break; default: - complaint (&symfile_complaints, _("unsupported stack op: '%s'"), - dwarf_stack_op_name (op, 1)); + { + const char *name = dwarf_stack_op_name (op); + + if (name) + complaint (&symfile_complaints, _("unsupported stack op: '%s'"), + name); + else + complaint (&symfile_complaints, _("unsupported stack op: '%02x'"), + op); + } + return (stack[stacki]); }