Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: gdb/valops.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/valarith.c ('k') | gdb/valprint.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
None
OLDNEW
1 /* Perform non-arithmetic operations on values, for GDB. 1 /* Perform non-arithmetic operations on values, for GDB.
2 2
3 Copyright (C) 1986-2012 Free Software Foundation, Inc. 3 Copyright (C) 1986-2012 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 addr2 -= value_address (v) + value_embedded_offset (v); 294 addr2 -= value_address (v) + value_embedded_offset (v);
295 return value_at (type, addr2); 295 return value_at (type, addr2);
296 } 296 }
297 } 297 }
298 298
299 return NULL; 299 return NULL;
300 } 300 }
301 301
302 /* Cast one pointer or reference type to another. Both TYPE and 302 /* Cast one pointer or reference type to another. Both TYPE and
303 the type of ARG2 should be pointer types, or else both should be 303 the type of ARG2 should be pointer types, or else both should be
304 reference types. Returns the new pointer or reference. */ 304 reference types. If SUBCLASS_CHECK is non-zero, this will force a
305 check to see whether TYPE is a superclass of ARG2's type. If
306 SUBCLASS_CHECK is zero, then the subclass check is done only when
307 ARG2 is itself non-zero. Returns the new pointer or reference. */
305 308
306 struct value * 309 struct value *
307 value_cast_pointers (struct type *type, struct value *arg2) 310 value_cast_pointers (struct type *type, struct value *arg2,
311 » » int subclass_check)
308 { 312 {
309 struct type *type1 = check_typedef (type); 313 struct type *type1 = check_typedef (type);
310 struct type *type2 = check_typedef (value_type (arg2)); 314 struct type *type2 = check_typedef (value_type (arg2));
311 struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1)); 315 struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1));
312 struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2)); 316 struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2));
313 317
314 if (TYPE_CODE (t1) == TYPE_CODE_STRUCT 318 if (TYPE_CODE (t1) == TYPE_CODE_STRUCT
315 && TYPE_CODE (t2) == TYPE_CODE_STRUCT 319 && TYPE_CODE (t2) == TYPE_CODE_STRUCT
316 && !value_logical_not (arg2)) 320 && (subclass_check || !value_logical_not (arg2)))
317 { 321 {
318 struct value *v2; 322 struct value *v2;
319 323
320 if (TYPE_CODE (type2) == TYPE_CODE_REF) 324 if (TYPE_CODE (type2) == TYPE_CODE_REF)
321 v2 = coerce_ref (arg2); 325 v2 = coerce_ref (arg2);
322 else 326 else
323 v2 = value_ind (arg2); 327 v2 = value_ind (arg2);
324 gdb_assert (TYPE_CODE (check_typedef (value_type (v2))) 328 gdb_assert (TYPE_CODE (check_typedef (value_type (v2)))
325 == TYPE_CODE_STRUCT && !!"Why did coercion fail?"); 329 == TYPE_CODE_STRUCT && !!"Why did coercion fail?");
326 v2 = value_cast_structs (t1, v2); 330 v2 = value_cast_structs (t1, v2);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 { 565 {
562 /* Duplicate the contents of arg2 into the destination vector. */ 566 /* Duplicate the contents of arg2 into the destination vector. */
563 memcpy (value_contents_writeable (val) + (i * TYPE_LENGTH (eltype)), 567 memcpy (value_contents_writeable (val) + (i * TYPE_LENGTH (eltype)),
564 value_contents_all (arg2), TYPE_LENGTH (eltype)); 568 value_contents_all (arg2), TYPE_LENGTH (eltype));
565 } 569 }
566 return val; 570 return val;
567 } 571 }
568 else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2)) 572 else if (TYPE_LENGTH (type) == TYPE_LENGTH (type2))
569 { 573 {
570 if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR) 574 if (code1 == TYPE_CODE_PTR && code2 == TYPE_CODE_PTR)
571 » return value_cast_pointers (type, arg2); 575 » return value_cast_pointers (type, arg2, 0);
572 576
573 arg2 = value_copy (arg2); 577 arg2 = value_copy (arg2);
574 deprecated_set_value_type (arg2, type); 578 deprecated_set_value_type (arg2, type);
575 set_value_enclosing_type (arg2, type); 579 set_value_enclosing_type (arg2, type);
576 set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */ 580 set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
577 return arg2; 581 return arg2;
578 } 582 }
579 else if (VALUE_LVAL (arg2) == lval_memory) 583 else if (VALUE_LVAL (arg2) == lval_memory)
580 return value_at_lazy (type, value_address (arg2)); 584 return value_at_lazy (type, value_address (arg2));
581 else if (code1 == TYPE_CODE_VOID) 585 else if (code1 == TYPE_CODE_VOID)
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 value_bitpos (toval), value_bitsize (toval)); 1292 value_bitpos (toval), value_bitsize (toval));
1289 dest_buffer = buffer; 1293 dest_buffer = buffer;
1290 } 1294 }
1291 else 1295 else
1292 { 1296 {
1293 changed_addr = value_address (toval); 1297 changed_addr = value_address (toval);
1294 changed_len = TYPE_LENGTH (type); 1298 changed_len = TYPE_LENGTH (type);
1295 dest_buffer = value_contents (fromval); 1299 dest_buffer = value_contents (fromval);
1296 } 1300 }
1297 1301
1298 » write_memory (changed_addr, dest_buffer, changed_len); 1302 » write_memory_with_notification (changed_addr, dest_buffer, changed_len);
1299 » observer_notify_memory_changed (changed_addr, changed_len,
1300 » » » » » dest_buffer);
1301 } 1303 }
1302 break; 1304 break;
1303 1305
1304 case lval_register: 1306 case lval_register:
1305 { 1307 {
1306 struct frame_info *frame; 1308 struct frame_info *frame;
1307 struct gdbarch *gdbarch; 1309 struct gdbarch *gdbarch;
1308 int value_reg; 1310 int value_reg;
1309 1311
1310 /* Figure out which frame this is in currently. */ 1312 /* Figure out which frame this is in currently. */
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 /* For functions, go through find_function_addr, which knows 1767 /* For functions, go through find_function_addr, which knows
1766 how to handle function descriptors. */ 1768 how to handle function descriptors. */
1767 arg2 = value_at_lazy (enc_type, 1769 arg2 = value_at_lazy (enc_type,
1768 find_function_addr (arg1, NULL)); 1770 find_function_addr (arg1, NULL));
1769 else 1771 else
1770 /* Retrieve the enclosing object pointed to. */ 1772 /* Retrieve the enclosing object pointed to. */
1771 arg2 = value_at_lazy (enc_type, 1773 arg2 = value_at_lazy (enc_type,
1772 (value_as_address (arg1) 1774 (value_as_address (arg1)
1773 - value_pointed_to_offset (arg1))); 1775 - value_pointed_to_offset (arg1)));
1774 1776
1775 /* Re-adjust type. */ 1777 return readjust_indirect_value_type (arg2, enc_type, base_type, arg1);
1776 deprecated_set_value_type (arg2, TYPE_TARGET_TYPE (base_type));
1777 /* Add embedding info. */
1778 set_value_enclosing_type (arg2, enc_type);
1779 set_value_embedded_offset (arg2, value_pointed_to_offset (arg1));
1780
1781 /* We may be pointing to an object of some derived type. */
1782 arg2 = value_full_object (arg2, NULL, 0, 0, 0);
1783 return arg2;
1784 } 1778 }
1785 1779
1786 error (_("Attempt to take contents of a non-pointer value.")); 1780 error (_("Attempt to take contents of a non-pointer value."));
1787 return 0; /* For lint -- never reached. */ 1781 return 0; /* For lint -- never reached. */
1788 } 1782 }
1789 1783
1790 1784
1791 /* Create a value for an array by allocating space in GDB, copying the 1785 /* Create a value for an array by allocating space in GDB, copying the
1792 data into that space, and then setting up an array value. 1786 data into that space, and then setting up an array value.
1793 1787
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 continue; 1968 continue;
1975 /* Array to pointer is a `trivial conversion' according to the 1969 /* Array to pointer is a `trivial conversion' according to the
1976 ARM. */ 1970 ARM. */
1977 1971
1978 /* We should be doing much hairier argument matching (see 1972 /* We should be doing much hairier argument matching (see
1979 section 13.2 of the ARM), but as a quick kludge, just check 1973 section 13.2 of the ARM), but as a quick kludge, just check
1980 for the same type code. */ 1974 for the same type code. */
1981 if (TYPE_CODE (t1[i].type) != TYPE_CODE (value_type (t2[i]))) 1975 if (TYPE_CODE (t1[i].type) != TYPE_CODE (value_type (t2[i])))
1982 return i + 1; 1976 return i + 1;
1983 } 1977 }

error: old chunk mismatch

OLDNEW
« no previous file with comments | « gdb/valarith.c ('k') | gdb/valprint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698