bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gdb/valprint.c:common_val_print


From: Morten Welinder
Subject: gdb/valprint.c:common_val_print
Date: Fri, 7 Sep 2007 20:19:14 -0400

Hi,

I am working on extending gdb's printing capabilities and I have noticed that
sometimes the "valaddr" (+embedded_offset) and "address" arguments to
val_print get out of sync.

To me it looks like common_val_print should add value_offset(val) to the
result of VALUE_ADDRESS, but I could be wrong.

The call in question is the second call print_pair below.  The value type
in question is std::pair<int,std::string> in case it matters.  value_offset is
20 for me; value_embedded_offset is (from memory) zero.

I have been working with gdb 6.5 (on i386), but common_val_print appears
unchanged in 6.6.

Morten


static void
print_pair (struct ui_file *stream, struct value *v,
            int format, int deref_ref, int recurse, enum val_prettyprint pretty)
{

  fputs_filtered ("<", stream);
  common_val_print (value_struct_elt (&v, NULL, "first", NULL, NULL),
                    stream, format, deref_ref, recurse, pretty);
  fputs_filtered (",", stream);
  common_val_print (value_struct_elt (&v, NULL, "second", NULL, NULL),
                    stream, format, deref_ref, recurse, pretty);
  fputs_filtered (">", stream);
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]