This patch fixes this build error below:
../../binutils-gdb/gdb/spu-linux-nat.c:616:1: error: no previous prototype for ‘_initialize_spu_nat’ [-Werror=missing-prototypes]
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* spu-linux-nat.c (_initialize_spu_nat): Declare.
When I verify my changes to target.h doesn't break build on aix, I get
the following build error on a clean GDB checkout.
../../binutils-gdb/gdb/aix-thread.c: In function 'pdc_read_regs':
../../binutils-gdb/gdb/aix-thread.c:366:4: error: passing argument 3 of 'ptrace32' makes integer from pointer without a cast [-Werror]
if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL))
^
../../binutils-gdb/gdb/aix-thread.c:263:1: note: expected 'long long int' but argument is of type 'uint32_t *'
ptrace32 (int req, int id, addr_ptr addr, int data, int *buf)
^
../../binutils-gdb/gdb/aix-thread.c:375:42: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL))
^
../../binutils-gdb/gdb/aix-thread.c:392:39: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL))
GCC uses -maix32 in default, so the 'long long' is 64 bit and address
is 32 bit. Such warnings should go away if -maix64 is used.
In this patch, I cast the parameter to uintptr_t first, and then cast
to addr_ptr.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
Joel Brobecker <brobecker@adacore.com>
* aix-thread.c (pdc_read_regs): Cast parameter to uintptr_t.
(pdc_write_regs): Likewise.
(fetch_regs_kernel_thread): Likewise.
(store_regs_kernel_thread): Likewise.
Consider the following code:
type Element is abstract tagged null record;
type GADataType is interface;
type Data_Type is new Element and GADataType with record
I : Integer := 42;
end record;
Result1 : Data_Type;
GGG1 : GADataType'Class := GADataType'Class (Result1);
When trying to create a varobj for variable ggg1, GDB currently
returns an object which has no child:
-var-create ggg1 * ggg1
^done,name="ggg1",numchild="0",[...]
This is incorrect, it should return an object which has one child
(field "i"). This is because tagged-type objects are dynamic, and
we need to apply a small transformation in order to get their actual
type. This is already done on the GDB/CLI side in ada-valprint,
and it needs to be done on the ada-varobj side as well.
gdb/ChangeLog:
* ada-varobj.c (ada_varobj_adjust_for_child_access): Convert
tagged type objects to their actual type.
gdb/testsuite/ChangeLog:
* gdb.ada/mi_interface: New testcase.
Consider the following types:
type Time_T is record
Secs : Integer;
end record;
Before : Time_T := (Secs => 1384395743);
In this example, we assume that type Time_T is the number of seconds
since Epoch, and so added a Python pretty-printer, to print this
type in a more human-friendly way. For instance:
(gdb) print before
$1 = Thu Nov 14 02:22:23 2013 (1384395743)
However, we've noticed that things stop working when this type is
embedded inside another record, and we try to print that record.
For instance, with the following declarations:
type Composite is record
Id : Integer;
T : Time_T;
end record;
Afternoon : Composite := (Id => 1, T => (Secs => 1384395865));
(gdb) print afternoon
$2 = (id => 1, t => (secs => 1384395865))
We expected instead:
(gdb) print afternoon
$2 = (id => 1, t => Thu Nov 14 02:24:25 2013 (1384395865))
This patch fixes the problem by making sure that we try to print
each field via a call to val_print, rather than calling ada_val_print
directly. We need to go through val_print, as the val_print
handles all language-independent features such as calling the
pretty-printer, knowing that ada_val_print will get called eventually
if actual Ada-specific printing is required (which should be the
most common scenario).
And because val_print takes the language as parameter, we enhanced
the print_field_values and print_variant_part to also take a language.
As a bonus, this allows us to remove a couple of references to
current_language.
gdb/ChangeLog:
* ada-valprint.c (print_field_values): Add "language" parameter.
Update calls to print_field_values and print_variant_part.
Pass new parameter "language" in call to val_print instead
of "current_language". Replace call to ada_val_print by call
to val_print.
(print_variant_part): Add "language" parameter.
(ada_val_print_struct_union): Update call to print_field_values.
gdb/testsuite/ChangeLog:
* gdb.ada/pp-rec-component.exp, gdb.ada/pp-rec-component.py,
gdb.ada/pp-rec-component/foo.adb, gdb.ada/pp-rec-component/pck.adb,
gdb.ada/pp-rec-component/pck.ads: New files.
ada_print_floating declares a char buffer with a size that we're hoping
to always be large enough to hold any string representation of a float
value. But that's not really necessary, and also forces us to create
a small wrapper (ui_memcpy) to perform the extraction from a temporary
stream into this buffer. This patches fixes both issues by relying on
ui_file_xstrdup. This forces us to make a few adjustments that are
minor in nature, as we now need to defer the cleanup to the end of
the function.
gdb/ChangeLog:
* ada-valprint.c (ui_memcpy): Delete.
(ada_print_floating): Update documentation. Add empty line
between between function documentation and implementation.
Delete variable "buffer". Use ui_file_xstrdup in place of
ui_file_put. Minor adjustments following this change.
This patch creates a new function called "ada_val_print_string"
whose code is directly extracted out of ada_val_print_array.
The extracted code is then replaced by a call to this new function,
followed by a "return". The return avoids the need for an "else"
branch, with the associated block nesting. The latter is not really
terrible in this case, but it seems more readable this way.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_string): New function,
extracted from ada_val_print_array.
(ada_val_print_array): Replace extracted code by call
to ada_val_print_string followed by a return. Move
"else" branch to the function's top block.
This patch moves ada_val_print_array to group it with the other
ada_val_print_* function which are being called by ada_val_print_1.
Since this function is in the same situation, it is more logical
to move it within that group.
It also rationalizes the function's prototype to match the prototype
of the other ada_val_print_* routines.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_array): Move implementation
down. Rename parameter "offset" and "val" into "offset_aligned"
and "original_value" respectively. Add parameter "offset".
The logic as currently implemented in this function was a little
difficult to follow, due to the nested of if/else conditions,
but most of the time, the "else" block was very simple. So this
patch re-organizes the code to use fewer levels of nesting by
using return statements, and writing the code as a sequence of
"if something simple, then handle it and return" blocks.
While touching this code, this patch changes the cryptic "???"
printed when trying to print a reference pointing to an undefined
type. This should only ever happen if the debugging information
was corrupted or improperly read. But in case that happens, we now
print "<ref to undefined type>" instead. This is more in line
with how we print other conditions such as optimized out pieces,
or synthetic pointers.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_ref): Rewrite by mostly
re-organizing the code. Change the "???" message printed
when target type is a TYPE_CODE_UNDEF into
"<ref to undefined type>".
The function print_record is a fairly small and straightforward
function which is only called from one location. So this patch
inlines the code at the point of call.
One small advantage is that the context of use of this patch has
now become such that we can assume that TYPE is not a typedef,
nor an enum. So thhe call to ada_check_typedef is unnecessary,
and this patch removes it.
gdb/ChangeLog:
* ada-valprint.c (print_record): Delete, implementation inlined...
(ada_val_print_struct_union): ... here. Remove call to
ada_check_typedef in inlined implementation.
The idea of this patch is that it's hard to have a global view of
ada_val_print_1 because its body spans over too many lines. Also,
each individual "case" block within the giant "switch" can be hard
to isolate if spanning over multiple pages as well.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_gnat_array): New function,
extracted from ada_val_print_1;
(ada_val_print_ptr, ada_val_print_num, ada_val_print_enum)
(ada_val_print_flt, ada_val_print_struct_union)
(ada_val_print_ref): Likewise.
(ada_val_print_1): Delete variables i and elttype.
Replace extracted-out code by call to corresponding
new functions.
I am not sure why this function was called in the first place, but
it disrupts the printing flow when in GDB/MI mode, ending the current
console stream output, and starting a new one. It's not clear whether,
with the code as currently written, the problem is actually visible
or only latent. But, it becomes visible when we replace one of the
"return" statements in the "switch" block just above by a "break"
statement (this is something I'd like to do, and what made me realize
the problem). With the gdb_flush call (after having replaced the
"return" statement as explained above), we get:
% gdb -q -i=mi ada_prg
(gdb)
print 1
&"print 1\n"
!! -> ~"$1 = 1"
!! -> ~"\n"
^done
With the gdb_flush call removed, we now get the entire output into
a single stream.
(gdb)
print 1
&"print 1\n"
~"$1 = 1"
~"\n"
^done
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Remove call to gdb_flush.
This is to standardize a little bit how printing is done, and in
particular make sure that everyone goes through val_print when
printing sub-objects. This helps making sure that standard features
handled by val_print get activated when expected.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Replace calls to
ada_val_print_1 by calls to val_print.
This is to help calling val_print. We would like to be more systematic
in calling val_print when printing, because it allows us to make sure
we take advantage of the standard features such as pretty-printing
which are handled by val_print.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_1): Add parameter "language".
Update calls to self accordingly. Replace calls to c_val_print
by calls to val_print.
Advance function declarations add to the maintenance cost, since
any update to the function prototype needs to be made twice.
For static functions, this is not necessary, and this patch
reorders the function so as to reduce the use of such advanche
declarations.
gdb/ChangeLog:
* ada-valprint.c (print_record): Delete declaration.
(adjust_type_signedness, ada_val_print_1): Likewise.
(ada_val_print): Move function implementation down.
(print_variant_part, print_field_values, print_record):
Move function implementation up.
Consider the following declarations:
typedef long our_time_t;
our_time_t current_time = 1384395743;
The purpose of this patch is to allow the use of a pretty-printer
for variables of type our_time_t. Normally, pretty-printing sniffers
use the tag name in order to determine which, if any, pretty-printer
should be used. But in the case above, the tag name is not set, since
it does not apply to integral types.
This patch extends the gdb.Type list of attributes to also include
the name of the type, thus allowing the sniffer to match against
that name. With that change, I was able to write a pretty-printer
which displays our variable as follow:
(gdb) print current_time
$1 = Thu Nov 14 02:22:23 2013 (1384395743)
gdb/ChangeLog:
* python/py-type.c (typy_get_name): New function.
(type_object_getset): Add entry for attribute "name".
* NEWS: Add entry mentioning this new attribute.
gdb/doc/ChangeLog:
* gdb.texinfo (Types In Python): Document new attribute Types.name.
gdb/testsuite:
* gdb.python/py-pp-integral.c: New file.
* gdb.python/py-pp-integral.py: New file.
* gdb.python/py-pp-integral.exp: New file.
Tested on x86_64-linux.
This patch removes the if statement and the comments together.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (set_exceptions_cmd): Remove an empty body 'if'
statement.
This patch fixes the following error.
../../../git/gdb/gnu-nat.c: In function 'info_port_rights':
../../../git/gdb/gnu-nat.c:3083:11: error: passing argument 1 of 'parse_to_comma_and_eval' from incompatible pointer type [-Werror]
In file included from ../../../git/gdb/breakpoint.h:23:0,
from ../../../git/gdb/inferior.h:37,
from ../../../git/gdb/gnu-nat.c:55:
../../../git/gdb/value.h:763:22: note: expected 'const char **' but argument is of type 'char **'
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (info_port_rights): Add qualifier const to
argument args.
This patch fixes the following error:
../../../git/gdb/gnu-nat.c: In function 'trace_me':
../../../git/gdb/gnu-nat.c:2106:8: error: old-style function definition [-Werror=old-style-definition]
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (trace_me): Use 'void' for empty argument list.
inf_tid_to_proc is not defined at all. This patch is to remove its
declaration.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (inf_tid_to_proc): Remove declaration.
This patch fixes this error below by declaring _initialize_gnu_nat.
../../../git/gdb/gnu-nat.c:3447:1: error: no previous prototype for '_initialize_gnu_nat' [-Werror=missing-prototypes]
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gnu-nat.c (_initialize_gnu_nat): Declare.
This patch changes the return type of gdbarch_byte_order and
gdbarch_byte_order_for_code, from 'int' to 'enum bfd_endian'.
gdb:
2014-01-07 Yao Qi <yao@codesourcery.com>
* gdbarch.sh (byte_order, byte_order_for_code): Change type to
'enum bfd_endian'.
(struct gdbarch_info) <byte_order>: Change type to
'enum bfd_endian'.
<byte_order_for_code>: Likewise.
* gdbarch.c, gdbarch.h: Regenerated.
This removes the last uses of the obsolete CONST macro from the tree.
I'm checking this in. Tested by rebuilding.
2014-01-06 Tom Tromey <tromey@redhat.com>
* doublest.c (convert_doublest_to_floatformat): Use const, not
CONST.
* somread.c (som_symtab_read): Likewise.
Commit 199570 fixed the --disable-install-libiberty behavior, but it also
added a bug where the enable path never works because the initial clear
of target_header_dir wasn't deleted. So we end up initializing properly
at the top only to reset it at the end all the time.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206367 138bc75d-0d04-0410-961f-82ee72b054a4
libiberty/ 2014-01-06 Gary Benson <gbenson@redhat.com>
* cp-demangle.c (struct d_print_info): New fields
next_saved_scope, copy_templates, next_copy_template and
num_copy_templates.
(d_count_templates): New function.
(d_print_init): New parameter "dc".
Estimate numbers of templates and scopes required.
(d_print_free): Removed function.
(cplus_demangle_print_callback): Allocate stack for
templates and scopes. Removed call to d_print_free.
(d_copy_templates): Removed function.
(d_save_scope): New function.
(d_get_saved_scope): Likewise.
(d_print_comp): Replace state saving/restoring code with
calls to d_save_scope and d_get_saved_scope.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206362 138bc75d-0d04-0410-961f-82ee72b054a4
gdb/ChangeLog:
* top.c (print_gdb_version): Set copyright year to 2014.
gdb/gdbserver/ChangeLog:
* gdbserver.c (gdbserver_version): Set copyright year to 2014.
* gdbreplay.c (gdbreplay_version): Likewise.