[PATCH] Fix agent code generate bug of ref

Tom Tromey tromey@redhat.com
Tue Mar 12 14:17:00 GMT 2013


>>>>> "Hui" == Hui Zhu <teawater@gmail.com> writes:

Hui> Sorry for my misunderstand in your mail.  Accord to discussion with
Hui> Yao in IRC.  I merge 2 patches together.
Hui> And I found that gdb_assert of access_memory.  It should use nbytes.

Thanks for doing this.

Hui> 2013-03-12  Yao Qi  <yao@codesourcery.com>
Hui> 	    Hui Zhu  <hui_zhu@mentor.com>
Hui> 	* dwarf2loc.c (access_memory): Change nbits to nbytes in gdb_assert.
Hui> 	(dwarf2_compile_expr_to_ax): Call access_memory in DW_OP_deref and
Hui> 	DW_OP_deref_size.

Hui> +  gdb_assert (nbytes > 0 && nbytes <= sizeof (LONGEST));

Hui> -	      default:
Hui> -		/* Note that get_DW_OP_name will never return
Hui> -		   NULL here.  */
Hui> -		error (_("Unsupported size %d in %s"),
Hui> -		       size, get_DW_OP_name (op));
Hui> -	      }

I think we need a sanity check before calling access_memory.
Otherwise, bad DWARF will be able to crash gdb.
The patch is ok with that change.

Tom



More information about the Gdb-patches mailing list