Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: fix PR c++/14999
@ 2013-01-08 17:11 Tom Tromey
  2013-01-18 18:25 ` Tom Tromey
  2013-01-19 15:54 ` Joel Brobecker
  0 siblings, 2 replies; 7+ messages in thread
From: Tom Tromey @ 2013-01-08 17:11 UTC (permalink / raw)
  To: gdb-patches

This fixes PR c++/14999.

The problem here is that setting a tracepoint and collecting a certain
local variable will cause a crash, if the source code was compiled with
clang.

The bug is just a missing call to require_rvalue when handling
DW_OP_fbreg in the DWARF->AX translator.

This patch includes a test case which is assembly created by clang, then
lightly hacked by me (to change the file and directory names).  I think
this is ok, since the original source file is so small; but if you
disagree let me know.

Built and regtested on x86-64 Fedora 16.

Tom

    	PR c++/14999:
    	* dwarf2loc.c (dwarf2_compile_expr_to_ax) <DW_OP_fbreg>:
    	Call require_rvalue.
    
    	* gdb.dwarf2/trace-crash.s: New file.
    	* gdb.dwarf2/trace-crash.exp: New file.

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 33300ee..2282feb 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2878,6 +2878,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 	    op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
 	    dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart,
 				       datastart + datalen, per_cu);
+	    require_rvalue (expr, loc);
 
 	    if (offset != 0)
 	      {
diff --git a/gdb/testsuite/gdb.dwarf2/trace-crash.S b/gdb/testsuite/gdb.dwarf2/trace-crash.S
new file mode 100644
index 0000000..3a9a771
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/trace-crash.S
@@ -0,0 +1,295 @@
+/* This file was created using Clang -g -S from this source
+   code:
+
+   int func(int p) {
+    int x = p + 3;
+    return x;
+   }
+
+   int main() { return func(3); }
+
+   See http://sourceware.org/bugzilla/show_bug.cgi?id=14999
+*/
+
+	.file	"trace-crash.c"
+	.file	1 "trace-crash.c"
+	.text
+	.globl	func
+	.align	16, 0x90
+	.type	func,@function
+func:                                   # @func
+	.cfi_startproc
+.Lfunc_begin0:
+	.loc	1 1 0                   # trace-crash.c:1:0
+# BB#0:                                 # %entry
+	movl	%edi, -4(%rsp)
+	.loc	1 2 0 prologue_end      # trace-crash.c:2:0
+.Ltmp0:
+	movl	-4(%rsp), %edi
+	addl	$3, %edi
+	movl	%edi, -8(%rsp)
+	.loc	1 3 0                   # trace-crash.c:3:0
+	movl	-8(%rsp), %eax
+	ret
+.Ltmp1:
+.Ltmp2:
+	.size	func, .Ltmp2-func
+.Lfunc_end0:
+	.cfi_endproc
+
+	.globl	main
+	.align	16, 0x90
+	.type	main,@function
+main:                                   # @main
+	.cfi_startproc
+.Lfunc_begin1:
+	.loc	1 6 0                   # trace-crash.c:6:0
+# BB#0:                                 # %entry
+	pushq	%rbp
+.Ltmp5:
+	.cfi_def_cfa_offset 16
+.Ltmp6:
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+.Ltmp7:
+	.cfi_def_cfa_register %rbp
+	subq	$16, %rsp
+	movl	$3, %edi
+	movl	$0, -4(%rbp)
+	.loc	1 6 0 prologue_end      # trace-crash.c:6:0
+.Ltmp8:
+	callq	func
+	addq	$16, %rsp
+	popq	%rbp
+	ret
+.Ltmp9:
+.Ltmp10:
+	.size	main, .Ltmp10-main
+.Lfunc_end1:
+	.cfi_endproc
+
+.Ltext_end:
+	.data
+.Ldata_end:
+	.text
+.Lsection_end1:
+	.section	.debug_info,"",@progbits
+.Lsection_info:
+	.section	.debug_abbrev,"",@progbits
+.Lsection_abbrev:
+	.section	.debug_aranges,"",@progbits
+	.section	.debug_macinfo,"",@progbits
+	.section	.debug_line,"",@progbits
+.Lsection_line:
+	.section	.debug_loc,"",@progbits
+	.section	.debug_pubtypes,"",@progbits
+	.section	.debug_str,"MS",@progbits,1
+.Linfo_string:
+	.section	.debug_ranges,"",@progbits
+.Ldebug_range:
+	.section	.debug_loc,"",@progbits
+.Lsection_debug_loc:
+	.text
+.Ltext_begin:
+	.data
+	.section	.debug_info,"",@progbits
+.L.debug_info_begin0:
+	.long	147                     # Length of Compilation Unit Info
+	.short	2                       # DWARF version number
+	.long	.L.debug_abbrev_begin   # Offset Into Abbrev. Section
+	.byte	8                       # Address Size (in bytes)
+	.byte	1                       # Abbrev [1] 0xb:0x8c DW_TAG_compile_unit
+	.long	.Linfo_string0          # DW_AT_producer
+	.short	12                      # DW_AT_language
+	.long	.Linfo_string1          # DW_AT_name
+	.quad	0                       # DW_AT_low_pc
+	.long	.Lsection_line          # DW_AT_stmt_list
+	.long	.Linfo_string2          # DW_AT_comp_dir
+	.byte	2                       # Abbrev [2] 0x26:0x4c DW_TAG_subprogram
+	.long	.Linfo_string3          # DW_AT_name
+	.byte	1                       # DW_AT_decl_file
+	.byte	1                       # DW_AT_decl_line
+                                        # DW_AT_prototyped
+	.long	114                     # DW_AT_type
+                                        # DW_AT_external
+	.quad	.Lfunc_begin0           # DW_AT_low_pc
+	.quad	.Lfunc_end0             # DW_AT_high_pc
+	.byte	1                       # DW_AT_frame_base
+	.byte	87
+                                        # DW_AT_APPLE_omit_frame_ptr
+	.byte	3                       # Abbrev [3] 0x43:0xe DW_TAG_formal_parameter
+	.long	.Linfo_string6          # DW_AT_name
+	.byte	1                       # DW_AT_decl_file
+	.byte	1                       # DW_AT_decl_line
+	.long	114                     # DW_AT_type
+	.byte	2                       # DW_AT_location
+	.byte	145
+	.byte	124
+	.byte	4                       # Abbrev [4] 0x51:0x20 DW_TAG_lexical_block
+	.quad	.Ltmp0                  # DW_AT_low_pc
+	.quad	.Ltmp1                  # DW_AT_high_pc
+	.byte	5                       # Abbrev [5] 0x62:0xe DW_TAG_variable
+	.long	.Linfo_string7          # DW_AT_name
+	.byte	1                       # DW_AT_decl_file
+	.byte	2                       # DW_AT_decl_line
+	.long	114                     # DW_AT_type
+	.byte	2                       # DW_AT_location
+	.byte	145
+	.byte	120
+	.byte	0                       # End Of Children Mark
+	.byte	0                       # End Of Children Mark
+	.byte	6                       # Abbrev [6] 0x72:0x7 DW_TAG_base_type
+	.long	.Linfo_string4          # DW_AT_name
+	.byte	5                       # DW_AT_encoding
+	.byte	4                       # DW_AT_byte_size
+	.byte	7                       # Abbrev [7] 0x79:0x1d DW_TAG_subprogram
+	.long	.Linfo_string5          # DW_AT_name
+	.byte	1                       # DW_AT_decl_file
+	.byte	6                       # DW_AT_decl_line
+	.long	114                     # DW_AT_type
+                                        # DW_AT_external
+	.quad	.Lfunc_begin1           # DW_AT_low_pc
+	.quad	.Lfunc_end1             # DW_AT_high_pc
+	.byte	1                       # DW_AT_frame_base
+	.byte	86
+	.byte	0                       # End Of Children Mark
+.L.debug_info_end0:
+	.section	.debug_abbrev,"",@progbits
+.L.debug_abbrev_begin:
+	.byte	1                       # Abbreviation Code
+	.byte	17                      # DW_TAG_compile_unit
+	.byte	1                       # DW_CHILDREN_yes
+	.byte	37                      # DW_AT_producer
+	.byte	14                      # DW_FORM_strp
+	.byte	19                      # DW_AT_language
+	.byte	5                       # DW_FORM_data2
+	.byte	3                       # DW_AT_name
+	.byte	14                      # DW_FORM_strp
+	.byte	17                      # DW_AT_low_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	16                      # DW_AT_stmt_list
+	.byte	6                       # DW_FORM_data4
+	.byte	27                      # DW_AT_comp_dir
+	.byte	14                      # DW_FORM_strp
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	2                       # Abbreviation Code
+	.byte	46                      # DW_TAG_subprogram
+	.byte	1                       # DW_CHILDREN_yes
+	.byte	3                       # DW_AT_name
+	.byte	14                      # DW_FORM_strp
+	.byte	58                      # DW_AT_decl_file
+	.byte	11                      # DW_FORM_data1
+	.byte	59                      # DW_AT_decl_line
+	.byte	11                      # DW_FORM_data1
+	.byte	39                      # DW_AT_prototyped
+	.byte	25                      # DW_FORM_flag_present
+	.byte	73                      # DW_AT_type
+	.byte	19                      # DW_FORM_ref4
+	.byte	63                      # DW_AT_external
+	.byte	25                      # DW_FORM_flag_present
+	.byte	17                      # DW_AT_low_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	18                      # DW_AT_high_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	64                      # DW_AT_frame_base
+	.byte	10                      # DW_FORM_block1
+	.ascii	 "\347\177"             # DW_AT_APPLE_omit_frame_ptr
+	.byte	25                      # DW_FORM_flag_present
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	3                       # Abbreviation Code
+	.byte	5                       # DW_TAG_formal_parameter
+	.byte	0                       # DW_CHILDREN_no
+	.byte	3                       # DW_AT_name
+	.byte	14                      # DW_FORM_strp
+	.byte	58                      # DW_AT_decl_file
+	.byte	11                      # DW_FORM_data1
+	.byte	59                      # DW_AT_decl_line
+	.byte	11                      # DW_FORM_data1
+	.byte	73                      # DW_AT_type
+	.byte	19                      # DW_FORM_ref4
+	.byte	2                       # DW_AT_location
+	.byte	10                      # DW_FORM_block1
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	4                       # Abbreviation Code
+	.byte	11                      # DW_TAG_lexical_block
+	.byte	1                       # DW_CHILDREN_yes
+	.byte	17                      # DW_AT_low_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	18                      # DW_AT_high_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	5                       # Abbreviation Code
+	.byte	52                      # DW_TAG_variable
+	.byte	0                       # DW_CHILDREN_no
+	.byte	3                       # DW_AT_name
+	.byte	14                      # DW_FORM_strp
+	.byte	58                      # DW_AT_decl_file
+	.byte	11                      # DW_FORM_data1
+	.byte	59                      # DW_AT_decl_line
+	.byte	11                      # DW_FORM_data1
+	.byte	73                      # DW_AT_type
+	.byte	19                      # DW_FORM_ref4
+	.byte	2                       # DW_AT_location
+	.byte	10                      # DW_FORM_block1
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	6                       # Abbreviation Code
+	.byte	36                      # DW_TAG_base_type
+	.byte	0                       # DW_CHILDREN_no
+	.byte	3                       # DW_AT_name
+	.byte	14                      # DW_FORM_strp
+	.byte	62                      # DW_AT_encoding
+	.byte	11                      # DW_FORM_data1
+	.byte	11                      # DW_AT_byte_size
+	.byte	11                      # DW_FORM_data1
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	7                       # Abbreviation Code
+	.byte	46                      # DW_TAG_subprogram
+	.byte	0                       # DW_CHILDREN_no
+	.byte	3                       # DW_AT_name
+	.byte	14                      # DW_FORM_strp
+	.byte	58                      # DW_AT_decl_file
+	.byte	11                      # DW_FORM_data1
+	.byte	59                      # DW_AT_decl_line
+	.byte	11                      # DW_FORM_data1
+	.byte	73                      # DW_AT_type
+	.byte	19                      # DW_FORM_ref4
+	.byte	63                      # DW_AT_external
+	.byte	25                      # DW_FORM_flag_present
+	.byte	17                      # DW_AT_low_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	18                      # DW_AT_high_pc
+	.byte	1                       # DW_FORM_addr
+	.byte	64                      # DW_AT_frame_base
+	.byte	10                      # DW_FORM_block1
+	.byte	0                       # EOM(1)
+	.byte	0                       # EOM(2)
+	.byte	0                       # EOM(3)
+.L.debug_abbrev_end:
+	.section	.debug_aranges,"",@progbits
+	.section	.debug_ranges,"",@progbits
+	.section	.debug_macinfo,"",@progbits
+	.section	.debug_str,"MS",@progbits,1
+.Linfo_string0:
+	.asciz	 "clang version 3.3 "
+.Linfo_string1:
+	.asciz	 "trace-crash.c"
+.Linfo_string2:
+	.asciz	 "/tmp"
+.Linfo_string3:
+	.asciz	 "func"
+.Linfo_string4:
+	.asciz	 "int"
+.Linfo_string5:
+	.asciz	 "main"
+.Linfo_string6:
+	.asciz	 "p"
+.Linfo_string7:
+	.asciz	 "x"
+
+	.section	".note.GNU-stack","",@progbits
diff --git a/gdb/testsuite/gdb.dwarf2/trace-crash.exp b/gdb/testsuite/gdb.dwarf2/trace-crash.exp
new file mode 100644
index 0000000..7331868
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/trace-crash.exp
@@ -0,0 +1,41 @@
+# Copyright 2013 Free Software Foundation, Inc.
+
+# 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 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib dwarf.exp
+load_lib trace-support.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+    return 0  
+}
+
+# This test can only be run on x86-64 targets.
+if {![istarget x86_64-*] || ![is_lp64_target]} {
+    return 0
+}
+
+standard_testfile .S
+
+if {[prepare_for_testing "${testfile}.exp" "${testfile}" ${testfile}.S \
+	 nodebug]} {
+    return -1
+}
+
+gdb_test "trace ${testfile}.c:3" "Tracepoint $decimal .*" \
+    "set tracepoint"
+
+# This is a regression test for a crash when converting a DWARF
+# expression to AX.
+gdb_trace_setactions "set tracepoint actions" "" "collect x" "^$"


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: fix PR c++/14999
  2013-01-08 17:11 RFC: fix PR c++/14999 Tom Tromey
@ 2013-01-18 18:25 ` Tom Tromey
  2013-01-19 15:54 ` Joel Brobecker
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2013-01-18 18:25 UTC (permalink / raw)
  To: gdb-patches

>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> This fixes PR c++/14999.

I'm checking this in now.

Tom


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: fix PR c++/14999
  2013-01-08 17:11 RFC: fix PR c++/14999 Tom Tromey
  2013-01-18 18:25 ` Tom Tromey
@ 2013-01-19 15:54 ` Joel Brobecker
  2013-01-19 19:34   ` Tom Tromey
  2013-01-21 16:04   ` Tom Tromey
  1 sibling, 2 replies; 7+ messages in thread
From: Joel Brobecker @ 2013-01-19 15:54 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1936 bytes --]

Hi Tom,

> The problem here is that setting a tracepoint and collecting a certain
> local variable will cause a crash, if the source code was compiled with
> clang.
>
> The bug is just a missing call to require_rvalue when handling
> DW_OP_fbreg in the DWARF->AX translator.
[...]
>     	PR c++/14999:
>     	* dwarf2loc.c (dwarf2_compile_expr_to_ax) <DW_OP_fbreg>:
>     	Call require_rvalue.
>     
>     	* gdb.dwarf2/trace-crash.s: New file.
>     	* gdb.dwarf2/trace-crash.exp: New file.

Unfortunately, this patch causes a number of regressions which do
appear with the testsuite if you run it with gdbserver.

At the heart of the regression is the fact that the dwarf-to-ax
compiler, for a variable whose location looks like this:

    (gdb) info address i
    Symbol "i" is a variable at frame base reg $rbp offset 16+-44.

will now generate:

    (gdb) maintenance agent-eval i
    Scope: 0x404953
    Reg mask: 40
      0  reg 6
      3  const8 16
      5  add
      6  ref32    <<<<<-----  Unwanted dereference
      7  ext 32   <<<<<-----
      9  const8 212
     11  ext 8
     13  add
     14  ref32
     15  ext 32
     17  end

This affects conditional breakpoints when running with a gdbserver,
because gdbserver now evaluates incorrectly the condition on the
gdbserver side.

I looked at the PR, and it seems to me that the problem comes
from the fact that the ax stack was missing the "reg 7" operation.
I don't really understand the code well enough to be sure about
my fix, in particular what the "loc" parameter is about, but
the attached patch seems to restore the origin behavior while
still keeping your new testcase happy.

gdb/ChangeLog:

        PR c++/14999:
        * dwarf2_compile_expr_to_ax (dwarf2_compile_expr_to_ax):
        Add a call to ax_reg for DW_OP_reg* opcodes.
        <DW_OP_fbreg>: Remove call to require_rvalue.

Tested on x86_64-linux with gdbserver, fixes about 125 failures.

-- 
Joel

[-- Attachment #2: 0001-Rework-GDB-PR-c-14999.patch --]
[-- Type: text/x-diff, Size: 1610 bytes --]

From 6ec232c4c61e5840042109ac119b8f284ff3f7b4 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Sat, 19 Jan 2013 19:13:14 +0400
Subject: [PATCH] Rework GDB PR c++/14999

gdb/ChangeLog:

        PR c++/14999:
        * dwarf2_compile_expr_to_ax (dwarf2_compile_expr_to_ax):
        Add a call to ax_reg for DW_OP_reg* opcodes.
        <DW_OP_fbreg>: Remove call to require_rvalue.
---
 gdb/dwarf2loc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 2282feb..b540ef5 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2765,6 +2765,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 	  dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_regx");
 	  loc->u.reg = translate_register (arch, op - DW_OP_reg0);
 	  loc->kind = axs_lvalue_register;
+	  ax_reg (expr, loc->u.reg);
 	  break;
 
 	case DW_OP_regx:
@@ -2772,6 +2773,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 	  dwarf_expr_require_composition (op_ptr, op_end, "DW_OP_regx");
 	  loc->u.reg = translate_register (arch, reg);
 	  loc->kind = axs_lvalue_register;
+	  ax_reg (expr, loc->u.reg);
 	  break;
 
 	case DW_OP_implicit_value:
@@ -2878,7 +2880,6 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 	    op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
 	    dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart,
 				       datastart + datalen, per_cu);
-	    require_rvalue (expr, loc);
 
 	    if (offset != 0)
 	      {
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: fix PR c++/14999
  2013-01-19 15:54 ` Joel Brobecker
@ 2013-01-19 19:34   ` Tom Tromey
  2013-01-21 16:04   ` Tom Tromey
  1 sibling, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2013-01-19 19:34 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Joel> Unfortunately, this patch causes a number of regressions which do
Joel> appear with the testsuite if you run it with gdbserver.

Oops, sorry, Joel.  I should have dug deeper.

Joel> I don't really understand the code well enough to be sure about
Joel> my fix, in particular what the "loc" parameter is about, but
Joel> the attached patch seems to restore the origin behavior while
Joel> still keeping your new testcase happy.

Feel free to kick regressions back to me.

Tom


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: fix PR c++/14999
  2013-01-19 15:54 ` Joel Brobecker
  2013-01-19 19:34   ` Tom Tromey
@ 2013-01-21 16:04   ` Tom Tromey
  2013-01-22  2:55     ` Joel Brobecker
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2013-01-21 16:04 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> I looked at the PR, and it seems to me that the problem comes
Joel> from the fact that the ax stack was missing the "reg 7" operation.
Joel> I don't really understand the code well enough to be sure about
Joel> my fix, in particular what the "loc" parameter is about, but
Joel> the attached patch seems to restore the origin behavior while
Joel> still keeping your new testcase happy.

Can you try the appended instead?
I am testing it here as well.

I think calling ax_reg and setting kind==axs_lvalue_register is wrong,
as it may result in a second ax_reg call if require_rvalue is called.

Instead I think we should mimic what dwarf2eval does for the fbreg case,
and only derferences lvalue_register values.

Tom

diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 2282feb..3688425 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2878,7 +2878,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
 	    op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
 	    dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart,
 				       datastart + datalen, per_cu);
-	    require_rvalue (expr, loc);
+	    if (loc->kind == axs_lvalue_register)
+	      require_rvalue (expr, loc);
 
 	    if (offset != 0)
 	      {


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: fix PR c++/14999
  2013-01-21 16:04   ` Tom Tromey
@ 2013-01-22  2:55     ` Joel Brobecker
  2013-01-22 15:57       ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2013-01-22  2:55 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> Can you try the appended instead?
> I am testing it here as well.

Thanks, Tom. I confirm your patch seems to be fixing the issue as well.

> diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
> index 2282feb..3688425 100644
> --- a/gdb/dwarf2loc.c
> +++ b/gdb/dwarf2loc.c
> @@ -2878,7 +2878,8 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
>  	    op_ptr = safe_read_sleb128 (op_ptr, op_end, &offset);
>  	    dwarf2_compile_expr_to_ax (expr, loc, arch, addr_size, datastart,
>  				       datastart + datalen, per_cu);
> -	    require_rvalue (expr, loc);
> +	    if (loc->kind == axs_lvalue_register)
> +	      require_rvalue (expr, loc);
>  
>  	    if (offset != 0)
>  	      {

-- 
Joel


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFC: fix PR c++/14999
  2013-01-22  2:55     ` Joel Brobecker
@ 2013-01-22 15:57       ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2013-01-22 15:57 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Joel> Thanks, Tom. I confirm your patch seems to be fixing the issue as well.

Thanks, Joel.

I'm checking it in with this ChangeLog entry:

2013-01-22  Tom Tromey  <tromey@redhat.com>

	* dwarf2loc.c (dwarf2_compile_expr_to_ax) <DW_OP_fbreg>: Only
	require_rvalue for a register location.

Tom


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-22 15:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-08 17:11 RFC: fix PR c++/14999 Tom Tromey
2013-01-18 18:25 ` Tom Tromey
2013-01-19 15:54 ` Joel Brobecker
2013-01-19 19:34   ` Tom Tromey
2013-01-21 16:04   ` Tom Tromey
2013-01-22  2:55     ` Joel Brobecker
2013-01-22 15:57       ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox