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

Unified Diff: gdb/cp-valprint.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/cp-support.c ('k') | gdb/cris-tdep.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/cp-valprint.c
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 7df9adfba49787a0d992f68c5c3b502d08bc3dd2..c066aa5e742d7166c01012e0d46d1b885ba30ee4 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -98,7 +98,7 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type";
int
cp_is_vtbl_ptr_type (struct type *type)
{
- char *typename = type_name_no_tag (type);
+ const char *typename = type_name_no_tag (type);
return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
}
@@ -358,6 +358,21 @@ cp_print_value_fields (struct type *type, struct type *real_type,
v, stream, recurse + 1,
options);
}
+ else if (i == TYPE_VPTR_FIELDNO (type))
+ {
+ int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
+ struct type *i_type = TYPE_FIELD_TYPE (type, i);
+
+ if (valprint_check_validity (stream, i_type, i_offset, val))
+ {
+ CORE_ADDR addr;
+
+ addr = extract_typed_address (valaddr + i_offset, i_type);
+ print_function_pointer_address (options,
+ get_type_arch (type),
+ addr, stream);
+ }
+ }
else
{
struct value_print_options opts = *options;
@@ -495,7 +510,7 @@ cp_print_value (struct type *type, struct type *real_type,
int boffset = 0;
int skip;
struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- char *basename = TYPE_NAME (baseclass);
+ const char *basename = TYPE_NAME (baseclass);
const gdb_byte *base_valaddr = NULL;
const struct value *base_val = NULL;
volatile struct gdb_exception ex;
@@ -539,9 +554,11 @@ cp_print_value (struct type *type, struct type *real_type,
if ((boffset + offset) < 0
|| (boffset + offset) >= TYPE_LENGTH (real_type))
{
- /* FIXME (alloca): unsafe if baseclass is really
- really large. */
- gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
+ gdb_byte *buf;
+ struct cleanup *back_to;
+
+ buf = xmalloc (TYPE_LENGTH (baseclass));
+ back_to = make_cleanup (xfree, buf);
if (target_read_memory (address + boffset, buf,
TYPE_LENGTH (baseclass)) != 0)
@@ -553,6 +570,7 @@ cp_print_value (struct type *type, struct type *real_type,
boffset = 0;
thistype = baseclass;
base_valaddr = value_contents_for_printing_const (base_val);
+ do_cleanups (back_to);
}
else
{
@@ -794,7 +812,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
if (domain != NULL)
{
- char *name;
+ const char *name;
fputs_filtered (prefix, stream);
name = type_name_no_tag (domain);
« no previous file with comments | « gdb/cp-support.c ('k') | gdb/cris-tdep.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698