From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19488 invoked by alias); 13 Nov 2005 15:38:10 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 19472 invoked by uid 22791); 13 Nov 2005 15:38:07 -0000 Received: from ip127.bb146.pacific.net.hk (HELO stl.com.hk) (202.64.146.127) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sun, 13 Nov 2005 15:38:07 +0000 Received: from 241.206.17.210.dyn.pacific.net.hk ([210.17.206.241] helo=[192.168.1.10]) by stl.com.hk with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1EbJsb-0007B0-9S for gdb-patches@sources.redhat.com; Sun, 13 Nov 2005 23:34:53 +0800 Message-ID: <43775DDB.6020408@tausq.org> Date: Sun, 13 Nov 2005 18:10:00 -0000 From: Randolph Chung User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [RFA/RFC] Support DW_OP_breg for tracepoints Content-Type: multipart/mixed; boundary="------------080107000606050301070800" X-SW-Source: 2005-11/txt/msg00162.txt.bz2 This is a multi-part message in MIME format. --------------080107000606050301070800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 792 Warning: I don't really understand how this works :-) On hppa-linux, when running gdb.trace/save-trace.exp, the test fails because of: "Unsupported DWARF opcode in the location of q1" The opcode in question is "DW_OP_breg3". The attached patch attempts to add support for DW_OP_breg0..DW_OP_breg31. With this patch hppa-linux passes the testcase, although not really understanding DWARF-2 I am not certain this is 100% correct. DWARF experts, comments appreciated. I was going to write the code for DW_OP_bregx too, but I'm not sure how that is supposed to work in terms of the "size" argument to that function since there are two params to read off the stack. In any case since I can't test that case easily I haven't written any code for it. Comments? ok to check in? randolph --------------080107000606050301070800 Content-Type: text/x-patch; name="d.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="d.diff" Content-length: 1501 2005-11-13 Randolph Chung * dwarf2loc.c (dwarf2_tracepoint_var_ref): Handle DW_OP_breg0 through DW_OP_breg31. Print DWARF opcode for unsupported case. Index: dwarf2loc.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2loc.c,v retrieving revision 1.30 diff -u -p -r1.30 dwarf2loc.c --- dwarf2loc.c 4 Nov 2005 02:42:34 -0000 1.30 +++ dwarf2loc.c 13 Nov 2005 15:29:18 -0000 @@ -479,9 +479,30 @@ dwarf2_tracepoint_var_ref (struct symbol ax_simple (ax, aop_add); value->kind = axs_lvalue_memory; } + else if (data[0] >= DW_OP_breg0 + && data[0] <= DW_OP_breg31) + { + unsigned int reg; + LONGEST offset; + gdb_byte *buf_end; + + reg = data[0] - DW_OP_breg0; + buf_end = read_sleb128 (data + 1, data + size, &offset); + if (buf_end != data + size) + error (_("Unexpected opcode after DW_OP_breg%u for symbol \"%s\"."), + reg, SYMBOL_PRINT_NAME (symbol)); + + ax_reg (ax, reg); + ax_const_l (ax, offset); + ax_simple (ax, aop_add); + + ax_const_l (ax, offset); + ax_simple (ax, aop_add); + value->kind = axs_lvalue_memory; + } else - error (_("Unsupported DWARF opcode in the location of \"%s\"."), - SYMBOL_PRINT_NAME (symbol)); + error (_("Unsupported DWARF opcode 0x%x in the location of \"%s\"."), + data[0], SYMBOL_PRINT_NAME (symbol)); } /* Return the value of SYMBOL in FRAME using the DWARF-2 expression --------------080107000606050301070800--