Yao Qi [Fri, 18 Apr 2014 11:19:22 +0000 (19:19 +0800)]
Call post_create_inferior in ctf_open.
We don't call post_create_inferior at the end of ctf_open. It is an
oversight in patch
[PATCH 2/2] Create inferior for ctf target.
https://sourceware.org/ml/gdb-patches/2014-01/msg01056.html
This patch is to call post_create_inferior at the end of ctf_open,
like the end of tfile_open.
gdb:
2014-04-19 Yao Qi <yao@codesourcery.com>
* ctf.c (ctf_open): Call post_create_inferior.
Yao Qi [Sat, 19 Apr 2014 02:14:58 +0000 (10:14 +0800)]
Get trace_regblock_size from metadata instead of event
In ctf trace, for each 'R' block, we save it as a "register" event,
as defined below in metadata.
event {
name = "register";
id = 0;
fields := struct {
ascii contents[440];
};
}
Nowadays, we initialize trace_regblock_size by getting the length of
"contents" from a "register" event. However, 'R' block may not exist
in traceframe, as a result, "register" event doesn't exist in trace file
and trace_regblock_size isn't set.
This patch changes to get trace_regblock_size from metadata (or declaration)
which always exists.
gdb:
2014-04-19 Yao Qi <yao@codesourcery.com>
* ctf.c (handle_id): New static variable.
(ctf_open_dir): Get handle_id from bt_context_add_trace return
value. Get the declaration of event "register" and get length
of field "contents".
Yao Qi [Fri, 18 Apr 2014 11:22:23 +0000 (19:22 +0800)]
Add null pointer check in ctf_xfer_partial
I find a gdb crash when gdb reads ctf trace. The crash is caused by passing
NULL to strcmp. This patch is to add null pointer check, as what we did
somewhere else in ctf.c.
gdb:
2014-04-19 Yao Qi <yao@codesourcery.com>
* ctf.c (ctf_xfer_partial): Check 'name' is NULL before strcmp.
Siva Chandra [Mon, 3 Mar 2014 13:08:47 +0000 (05:08 -0800)]
Remove unnecessary argument METHOD to valops.c:oload_method_static.
* valops.c (oload_method_static): Remove unnecessary argument
METHOD. Update all callers.
Alan Modra [Sat, 19 Apr 2014 00:00:59 +0000 (09:30 +0930)]
daily update
Tristan Gingold [Thu, 3 Apr 2014 12:45:31 +0000 (14:45 +0200)]
mach-o: layout executables
bfd/
* mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content,
bind_content, weak_bind_content, lazy_bind_content,
export_content.
(bfd_mach_o_load_command): Add comments, add next field.
(mach_o_data_struct): Replace commands field by first_command
and last_command.
* mach-o.c (bfd_mach_o_append_command): New function.
(bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines.
(bfd_mach_o_bfd_copy_private_section_data): Check flavour,
copy fields.
(bfd_mach_o_bfd_copy_private_header_data): Copy load commands.
(bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions.
(bfd_mach_o_write_thread): Use macro instead of literal.
(bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib)
(bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New
functions.
(bfd_mach_o_write_symtab_content): New function (extracted
from bfd_mach_o_write_symtab).
(bfd_mach_o_write_symtab): Split.
(bfd_mach_o_count_indirect_symbols): Move
(bfd_mach_o_build_dysymtab): Remove layout code.
(bfd_mach_o_write_contents): Rewritten to build commands in order.
(bfd_mach_o_count_sections_for_seg): Remove.
(bfd_mach_o_build_obj_seg_command): New function (extracted from
bfd_mach_o_build_seg_command).
(bfd_mach_o_build_exec_seg_command): New function.
(bfd_mach_o_build_dysymtab_command): Remove.
(bfd_mach_o_layout_commands): New function.
(bfd_mach_o_init_segment): New function.
(bfd_mach_o_build_commands): Major rework to handle non-object
files.
(bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New
function.
(bfd_mach_o_read_dyld_info): Clear content fields.
(bfd_mach_o_read_segment): Adjust call.
(bfd_mach_o_flatten_sections): Adjust as now load commands are
chained.
(bfd_mach_o_scan_start_address, bfd_mach_o_scan)
(bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address)
(bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment):
Likewise.
binutils/
* od-macho.c (dump_section_map): Adjust as load commands
are now chained.
(dump_load_command, dump_section_content): Likewise.
Tristan Gingold [Wed, 9 Apr 2014 08:16:39 +0000 (10:16 +0200)]
mach-o: Define copy_private_header instead of copy_private_bfd.
bfd/
* mach-o-target.c (bfd_mach_o_bfd_copy_private_header_data):
Define instead of bfd_mach_o_bfd_copy_private_bfd_data.
* mach-o.c (bfd_mach_o_bfd_copy_private_bfd_data): Rename.
* mach-o.h (bfd_mach_o_bfd_copy_private_bfd_data): Likewise.
Tristan Gingold [Wed, 9 Apr 2014 08:15:50 +0000 (10:15 +0200)]
mach-o: remove name_len field.
bfd/
* mach-o.h (bfd_mach_o_dylinker_command)
(bfd_mach_o_dylib_command, bfd_mach_o_fvmlib_command): Remove
name_len field.
* mach-o.c (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib)
(bfd_mach_o_read_fvmlib): Adjust after name_len removal.
Pedro Alves [Fri, 18 Apr 2014 09:15:21 +0000 (10:15 +0100)]
Fix PR backtrace/15558
This PR is about an assertion failure in GDB that can be triggered by
setting "backtrace limit" to a value that causes GDB to stop unwinding
after an inline frame. In this case, an assertion in
inline_frame_this_id will trigger:
/* We need a valid frame ID, so we need to be based on a valid
frame. (...). */
gdb_assert (frame_id_p (*this_id));
Looking at the function:
static void
inline_frame_this_id (struct frame_info *this_frame,
void **this_cache,
struct frame_id *this_id)
{
struct symbol *func;
/* In order to have a stable frame ID for a given inline function,
we must get the stack / special addresses from the underlying
real frame's this_id method. So we must call get_prev_frame.
Because we are inlined into some function, there must be previous
frames, so this is safe - as long as we're careful not to
create any cycles. */
*this_id = get_frame_id (get_prev_frame (this_frame));
we see we're computing the frame id for the inline frame. If this is
an inline frame, which is a virtual frame constructed based on debug
info, on top of a real stack frame, we should _always_ be able to find
where the frame was inlined into, as that ultimately just means
peeling off the virtual frames on top of the real stack frame. If
there ultimately was no prev (real) stack frame, then we wouldn't have
been able to construct the inline frame either, by design. That's
what the assertion catches.
So we have an inline frame, we should _always_ be able to compute its
ID, even if that means bypassing the user backtrace limits to get at
the real stack frame's info. The problem is that inline_frame_id
calls get_prev_frame, and that takes user backtrace limits into
account. Code that wants to bypass the limits calls get_prev_frame_1
instead.
Note how get_prev_frame_1 already skips all checks for inline frames:
/* If we are unwinding from an inline frame, all of the below tests
were already performed when we unwound from the next non-inline
frame. We must skip them, since we can not get THIS_FRAME's ID
until we have unwound all the way down to the previous non-inline
frame. */
if (get_frame_type (this_frame) == INLINE_FRAME)
return get_prev_frame_if_no_cycle (this_frame);
And note how the related frame_unwind_caller_id function also uses
get_prev_frame_1:
struct frame_id
frame_unwind_caller_id (struct frame_info *next_frame)
{
struct frame_info *this_frame;
/* Use get_prev_frame_1, and not get_prev_frame. The latter will truncate
the frame chain, leading to this function unintentionally
returning a null_frame_id (e.g., when a caller requests the frame
ID of "main()"s caller. */
next_frame = skip_artificial_frames (next_frame);
this_frame = get_prev_frame_1 (next_frame);
if (this_frame)
return get_frame_id (skip_artificial_frames (this_frame));
else
return null_frame_id;
}
get_prev_frame_1 is currently static in frame.c. As a _1 suffix is
not a good name for an extern function, I've renamed it.
Tested on x86-64 Fedora 17.
gdb/
2014-04-18 Pedro alves <palves@redhat.com>
Tom Tromey <tromey@redhat.com>
PR backtrace/15558
* frame.c (get_prev_frame_1): Rename to ...
(get_prev_frame_always): ... this, and make extern. Adjust.
(skip_artificial_frames): Use get_prev_frame_always.
(frame_unwind_caller_id, frame_pop, get_prev_frame)
(get_frame_unwind_stop_reason): Adjust to rename.
* frame.h (get_prev_frame_always): Declare.
* inline-frame.c: Include frame.h.
(inline_frame_this_id): Use get_prev_frame_always.
gdb/testsuite/
2014-04-18 Tom Tromey <palves@redhat.com>
Pedro alves <tromey@redhat.com>
PR backtrace/15558
* gdb.opt/inline-bt.exp: Test backtracing from an inline function
with a backtrace limit.
* gdb.python/py-frame-inline.exp: Test running to an inline
function with a backtrace limit, and printing the newest frame.
* gdb.python/py-frame-inline.c (main): Call f.
Tristan Gingold [Fri, 18 Apr 2014 09:03:46 +0000 (11:03 +0200)]
solib-darwin: simplify code.
Use bfd_mach_o_get_base_address to extract load address.
gdb/
* solib-darwin.c (darwin_solib_create_inferior_hook): Simplify
code by using bfd_mach_o_get_base_address.
Tristan Gingold [Wed, 9 Apr 2014 08:10:44 +0000 (10:10 +0200)]
mach-o: add page_size to backend data.
This is preliminary work to layout executables.
bfd/
* mach-o.h (bfd_mach_o_backend_data): Add page_size field.
* mach-o-target.c: Check TARGET_PAGESIZE is defined.
(TARGET_NAME_BACKEND): Add TARGET_PAGESIZE.
* mach-o.c (TARGET_PAGESIZE): Define and undefined for
each targets declared.
* mach-o-x86-64.c (TARGET_PAGESIZE): Define.
* mach-o-i386.c (TARGET_PAGESIZE): Define.
Tristan Gingold [Wed, 16 Apr 2014 14:01:47 +0000 (16:01 +0200)]
mach-o.c: use boolean instead of int to return status.
bfd/
* mach-o.c (bfd_mach_o_write_thread)
(bfd_mach_o_write_section_32, bfd_mach_o_write_section_64)
(bfd_mach_o_write_segment_32, bfd_mach_o_write_segment_64)
(bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib)
(bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_prebind_cksum)
(bfd_mach_o_read_twolevel_hints, bfd_mach_o_read_fvmlib)
(bfd_mach_o_read_thread, bfd_mach_o_read_dysymtab)
(bfd_mach_o_read_symtab, bfd_mach_o_read_uuid)
(bfd_mach_o_read_linkedit, bfd_mach_o_read_str)
(bfd_mach_o_read_dyld_info, bfd_mach_o_read_segment)
(bfd_mach_o_read_segment_32, bfd_mach_o_read_segment_64)
(bfd_mach_o_read_command): Now return a boolean status.
Adjust return statements.
(bfd_mach_o_write_contents, bfd_mach_o_scan): Adjust tests.
(bfd_mach_o_core_file_failing_command): Remove useless initialization.
Alan Modra [Fri, 18 Apr 2014 00:00:42 +0000 (09:30 +0930)]
daily update
Marcus Shawcroft [Thu, 17 Apr 2014 14:26:37 +0000 (15:26 +0100)]
Drop srcdir from untested source path.
Kwok Cheung Yeung [Thu, 17 Apr 2014 13:13:44 +0000 (14:13 +0100)]
This patch causes local GOT entries addressed via a 16-bit index to
be placed towards the front of local GOT space, while entries addressed
via a 32-bit index are placed towards the rear.
Provided that there are fewer than ~16K local GOT entries addressed via
a 16-bit index in total, this should eliminate any relocation overflows
caused by such GOT entries being allocated beyond the addressable range.
bfd/
* elfxx-mips.c (struct mips_got_info): Delete assigned_gotno
field. Add assigned_low_gotno and assigned_high_gotno fields.
(mips_elf_create_local_got_entry): Update out-of-space condition.
Set index of new GOT entry to assigned_low_gotno if required by
the current relocation, else set it to assigned_high_gotno.
(mips_elf_set_global_gotidx): Replace uses of assigned_gotno
with assigned_low_gotno.
(mips_elf_multi_got): Initialize assigned_low_gotno and
assigned_high_gotno in secondary GOTs. Use assigned_low_gotno
in place of assigned_gotno when handling global GOT entries.
(mips_elf_lay_out_got): Initialize assigned_low_gotno and
assigned_high_gotno.
(_bfd_mips_elf_finish_dynamic_sections): Account for a possible
gap in the middle of local GOT space.
ld/testsuite/
* ld-mips-elf/elf-rel-xgot-n32.d: Update for new GOT layout.
* ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise.
* ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise.
Ulrich Weigand [Thu, 17 Apr 2014 12:09:49 +0000 (14:09 +0200)]
Enable DWARF unwinders for SPU
This patch enables use of DWARF unwinders for the SPU target.
In addition to appending the DWARF unwinders, we also need to install
a spu_dwarf_reg_to_regnum that maps the raw stack pointer register to
the cooked version (to avoid mismatches with gdbarch_sp_regnum).
This also causes confusion with the AX collect handling, so we also
install ax_pseudo_register routines to handle the cooked SP.
gdb/
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
* spu-tdep.c: Include "dwarf2-frame.h" and "ax.h".
(spu_ax_pseudo_register_collect): New function.
(spu_ax_pseudo_register_push_stack): Likewise.
(spu_dwarf_reg_to_regnum): Likewise.
(spu_gdbarch_init): Install them. Append DWARF unwinders.
Ulrich Weigand [Thu, 17 Apr 2014 12:01:39 +0000 (14:01 +0200)]
Use address_from_register in dwarf2-frame.c:read_addr_from_reg
This patch fixes a problem that prevented use of the Dwarf unwinders on SPU,
because dwarf2-frame.c common code did not support the situation where the
stack and/or frame pointer is maintained in a *vector* register. This is
because read_addr_from_reg is hard-coded to assume that such pointers can
be read from registers via a simple get_frame_register / unpack_pointer
operation.
Now, there *is* a routine address_from_register that calls into the
appropriate tdep routines to handle pointer values in "weird" registers
like on SPU, but it turns out I cannot simply change dwarf2-frame.c to
use address_from_register. This is because address_from_register uses
value_from_register to create a (temporary) value, and that routine
at some point calls get_frame_id in order to set up that value's
VALUE_FRAME_ID entry.
However, the dwarf2-frame.c read_addr_from_reg routine will be called
during early unwinding (to unwind the frame's CFA), at which point the
frame's ID is not actually known yet! This would cause an assert.
On the other hand, we may notice that VALUE_FRAME_ID is only needed in the
value returned by value_from_register if that value is later used as an
lvalue. But this is obviously never done to the temporary value used in
address_from_register. So, if we could change address_from_register to
not call value_from_register but instead accept constructing a value
that doesn't have VALUE_FRAME_ID set, things should be fine.
To do that, we can change the value_from_register callback to accept
a FRAME_ID instead of a FRAME; the only existing uses of the FRAME
argument were either to extract its frame ID, or its gdbarch. (To
keep a way of getting at the latter, we also change the callback's
type from "f" to "m".) Together with the required follow-on changes
in the existing value_from_register implementations (including the
default one), this seems to fix the problem.
As another minor interface cleanup, I've removed the explicit TYPE
argument from address_from_register. This routine really always
uses a default pointer type, and in the new implementation it -to
some extent- relies on that fact, in that it will now no longer
handle types that require gdbarch_convert_register_p handling.
gdb:
2014-04-17 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (value_from_register): Make class "m" instead of "f".
Replace FRAME argument with FRAME_ID.
* gdbarch.c, gdbarch.h: Regenerate.
* findvar.c (default_value_from_register): Add GDBARCH argument;
replace FRAME by FRAME_ID. No longer call get_frame_id.
(value_from_register): Update call to gdbarch_value_from_register.
* value.h (default_value_from_register): Update prototype.
* s390-linux-tdep.c (s390_value_from_register): Update interface
and call to default_value_from_register.
* spu-tdep.c (spu_value_from_register): Likewise.
* findvar.c (address_from_register): Remove TYPE argument.
Do not call value_from_register; use gdbarch_value_from_register
with null_frame_id instead.
* value.h (address_from_register): Update prototype.
* dwarf2-frame.c (read_addr_from_reg): Use address_from_register.
* dwarf2loc.c (dwarf_expr_read_addr_from_reg): Update for
address_from_register interface change.
Marcus Shawcroft [Thu, 17 Apr 2014 09:52:43 +0000 (10:52 +0100)]
Drop prefix from unsupported source path.
Alan Modra [Thu, 17 Apr 2014 03:38:32 +0000 (13:08 +0930)]
Fix LTO mismatched TLS reference
PR 16846
* elflink.c (_bfd_elf_merge_symbol): Ignore TLS mismatch when
current bfd is a plugin. Don't always set type_change_ok
when old bfd is a plugin.
Yao Qi [Mon, 24 Mar 2014 03:26:06 +0000 (11:26 +0800)]
[testsuite] Set target-charset to ascii
Hi,
We find gdb.base/printcmds.exp fails a lot on windows host, like this,
p ctable1[163]
$204 = 163 '£'
(gdb) FAIL: gdb.base/printcmds.exp: p ctable1[163]
however, on linux host,
p ctable1[163]
$205 = 163 '\243'
(gdb) PASS: gdb.base/printcmds.exp: p ctable1[163]
The printing related code is in valprint.c:print_wchar,
if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
&& w != LCST ('8')
&& w != LCST ('9'))))
{
gdb_wchar_t wchar = w;
if (w == gdb_btowc (quoter) || w == LCST ('\\'))
obstack_grow_wstr (output, LCST ("\\"));
obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
}
else
{
// print W in hex or octal digits
}
When I debug gdb on different hosts, I find
on windows host, gdb_iswprint (iswprint) returns true if 'w' is 163.
However, on linux host, iswprint returns false if 'w' is 163. Looks
this difference is caused by the charset. On Linux host,
the target-charset is ANSI_X3.4-1968, while on windows host, the
target-charset is CP1252.
We can see how target-charset affects the output. On linux host,
(gdb) set target-charset ASCII
(gdb) p ctable1[163]
$1 = 163 '\243'
(gdb) set target-charset CP1252
(gdb) p ctable1[163]
$2 = 163 '£'
we can print the pound sign too, and it shows target-charset does
affect the output.
This patch is to set target-charset temporarily to ASCII for some
charset-sensitive tests. Tested on arm-none-eabi and
powerpc-linux-gnu on mingw32 host. More than one hundred fails are
fixed.
gdb/testsuite:
2014-04-17 Yao Qi <yao@codesourcery.com>
* lib/gdb.exp (with_target_charset): New proc.
* gdb.base/printcmds.exp (test_print_all_chars): Wrap tests with
with_target_charset.
(test_print_strings): Likewise.
(test_repeat_bytes): Likewise.
* gdb.base/setvar.exp: Set target-charset to ASCII temporarily
for some tests.
Yao Qi [Thu, 13 Mar 2014 06:07:26 +0000 (14:07 +0800)]
Automatic link generation by doxygen
Nowadays, we have one page on "GDB Types" generated by doxygen, but types
and macros referenced in doc are not linked to their definitions. This
patch tweaks the comments a little to use doxygen syntax so that these
types and macros are linked their definitions.
Is it OK?
gdb:
2014-04-17 Yao Qi <yao@codesourcery.com>
* gdbtypes.h: Update comments to link to types and macros'
definitions.
Alan Modra [Thu, 17 Apr 2014 00:01:10 +0000 (09:31 +0930)]
daily update
Siva Chandra [Wed, 16 Apr 2014 22:41:35 +0000 (15:41 -0700)]
Siva Chandra [Mon, 14 Apr 2014 13:50:24 +0000 (06:50 -0700)]
Remove unused and incorrect macro TYPE_FN_FIELDS.
* gdbtypes.h: Remove definition of the macro TYPE_FN_FIELDS.
Keith Seitz [Wed, 16 Apr 2014 21:39:10 +0000 (14:39 -0700)]
PR gdb/15827
Install some sanity checks that sibling DIE offsets are not beyond the
defined limits of the DWARF input buffer in read_partial_die and skip_one_die.
2014-03-20 Keith Seitz <keiths@redhat.com>
PR gdb/15827
* dwarf2read.c (skip_one_die): Check that all relative-offset
sibling DIEs fall within range of the current reader's buffer.
(read_partial_die): Likewise.
2014-03-20 Keith Seitz <keiths@redhat.com>
PR gdb/15827
* gdb.dwarf2/corrupt.c: New file.
* gdb.dwarf2/corrupt.exp: New file.
Keith Seitz [Wed, 16 Apr 2014 21:20:19 +0000 (14:20 -0700)]
PR c++/16597
[forgot to commit/push these with previous push]
If lookup_symbol_file tries to locate a member variable with NULL name:
/* A simple lookup failed. Check if the symbol was defined in
a base class. */
cleanup = make_cleanup (null_cleanup, NULL);
/* Find the name of the class and the name of the method,
variable, etc. */
prefix_len = cp_entire_prefix_len (name);
/* If no prefix was found, search "this". */
if (prefix_len == 0)
{
struct type *type;
struct symbol *this;
this = lookup_language_this (language_def (language_cplus), block);
if (this == NULL)
{
do_cleanups (cleanup);
return NULL;
}
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
klass = xstrdup (TYPE_NAME (type));
nested = xstrdup (name);
}
TYPE_NAME (type) is NULL, so xstrdup (NULL) and boom!
This can happen, e.g., with clang++. See testsuite/gdb.cp/namelessclass.exp
or the bugzilla report.
This patch simply adds a fencepost against this case, allowing the caller
of lookup_symbol_file to search other blocks for the right symbol.
Keith Seitz [Wed, 16 Apr 2014 21:12:22 +0000 (14:12 -0700)]
PR c++/16597
If lookup_symbol_file tries to locate a member variable with NULL name:
/* A simple lookup failed. Check if the symbol was defined in
a base class. */
cleanup = make_cleanup (null_cleanup, NULL);
/* Find the name of the class and the name of the method,
variable, etc. */
prefix_len = cp_entire_prefix_len (name);
/* If no prefix was found, search "this". */
if (prefix_len == 0)
{
struct type *type;
struct symbol *this;
this = lookup_language_this (language_def (language_cplus), block);
if (this == NULL)
{
do_cleanups (cleanup);
return NULL;
}
type = check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (this)));
klass = xstrdup (TYPE_NAME (type));
nested = xstrdup (name);
}
TYPE_NAME (type) is NULL, so xstrdup (NULL) and boom!
This can happen, e.g., with clang++. See testsuite/gdb.cp/namelessclass.exp
or the bugzilla report.
This patch simply adds a fencepost against this case, allowing the caller
of lookup_symbol_file to search other blocks for the right symbol.
Steve Ellcey [Wed, 16 Apr 2014 17:47:13 +0000 (10:47 -0700)]
2014-04-16 Steve Ellcey <sellcey@mips.com>
* emultempl/elf32.em: Include safe-ctype.h.
Steve Ellcey [Wed, 16 Apr 2014 17:45:08 +0000 (10:45 -0700)]
2014-04-16 Steve Ellcey <sellcey@mips.com>
* ldbuildid.c (generate_build_id): Add ATTRIBUTE_UNUSED to size arg.
Doug Evans [Wed, 16 Apr 2014 17:40:41 +0000 (10:40 -0700)]
Fix wrapper.exp testcase with stdio gdbserver.
* lib/gdbserver-support.exp (gdbserver_default_get_remote_address):
Add comment.
(gdbserver_default_get_comm_port): New function.
(gdbserver_start): Check if board file provided
"gdbserver,get_comm_port" and use it if so.
* boards/native-stdio-gdbserver.exp (sockethost): Set to "".
(gdb,socketport): Set to "stdio".
(gdbserver,get_comm_port): Set to ${board}_get_comm_port.
(stdio_gdbserver_template): Delete.
(${board}_get_remote_address): Update.
(${board}_build_remote_cmd): Delete.
(${board}_get_comm_port): New function.
(${board}_spawn): Update.
* boards/remote-stdio-gdbserver.exp (${board}_build_remote_cmd):
Delete.
(${board}_get_remote_address): Update.
(${board}_get_comm_port): New function.
Andrew Burgess [Wed, 16 Apr 2014 16:42:29 +0000 (17:42 +0100)]
gdb.base/memattr.exp regexp improvements.
https://sourceware.org/ml/gdb-patches/2014-04/msg00210.html
Improve the regexp used in the memattr.exp test so allow for different
memory regions (.data / .bss) being laid out in different orders.
gdb/testsuite/ChangeLog:
* gdb.base/memattr.exp: Improve regexps to handle memory regions
appearing in any order.
Alan Modra [Wed, 16 Apr 2014 13:28:15 +0000 (22:58 +0930)]
Fix more fallout from TC_CONS_FIX_NEW change
* config/tc-tilegx.h (TC_CONS_FIX_NEW): Add RELOC arg.
* config/tc-tilepro.h (TC_CONS_FIX_NEW): Likewise.
Tristan Gingold [Fri, 11 Apr 2014 15:10:03 +0000 (17:10 +0200)]
Mach-O: Add objdump -P dyld_info to dump dyld data.
include/mach-o/
* loader.h: Add macros for rebase, bind and export constants.
binutils/
* od-macho.c (OPT_DYLD_INFO): New macro.
(options): Add entry for dyld_info.
(mach_o_help): Likewise.
(load_and_dump, dump_dyld_info_rebase, dump_dyld_info_bind)
(dump_dyld_info_export_1, dump_dyld_info_export): New functions.
(bfd_mach_o_dyld_rebase_type_name): New array.
(export_info_data): New struct.
(dump_dyld_info): Add verbose argument. Dump rebase, bind and
exports data.
(dump_load_command): Adjust dump_dyld_info call.
(mach_o_dump): Handle dyld_info.
Tristan Gingold [Fri, 11 Apr 2014 13:27:10 +0000 (15:27 +0200)]
Mach-O: improve objdump -P load output.
binutils/
* od-macho.c (dump_header): Display sizeofcmds in decimal too.
(dump_segment): Reformat output.
(dump_dyld_info): Also display end offsets.
(dump_load_command): Add IDX argument, display commands size
and offset, reformat display.
(dump_load_commands): Adjust for added argument.
Tristan Gingold [Wed, 9 Apr 2014 08:12:45 +0000 (10:12 +0200)]
Mach-O: add cpu and cpusubtype caps.
include/mach-o/
2014-04-16 Tristan Gingold <gingold@adacore.com>
* loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64)
(BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define.
bfd/
2014-04-16 Tristan Gingold <gingold@adacore.com>
* mach-o-x86-64.c (bfd_mach_o_x86_64_mkobject): Adjust cpusubtype
flag.
Alan Modra [Wed, 16 Apr 2014 02:17:13 +0000 (11:47 +0930)]
fill ppc476 fixup area
Stops false positive warnings from scanner.
* elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area
with "ba 0" rather than zeros.
Alan Modra [Wed, 16 Apr 2014 00:01:06 +0000 (09:31 +0930)]
daily update
Doug Evans [Tue, 15 Apr 2014 23:11:32 +0000 (16:11 -0700)]
* gdb.gdb/selftest.exp (do_steps_and_nexts): Don't reference
uninitialized value of "description".
Cary Coutant [Tue, 15 Apr 2014 19:06:29 +0000 (12:06 -0700)]
2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
elfcpp/
* mips.h (R _MIPS16_TLS_GD, R_MIPS16_TLS_LDM, R_MIPS16_TLS_DTPREL_HI16,
R_MIPS16_TLS_DTPREL_LO16, R_MIPS16_TLS_GOTTPREL,
R_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_LO16, R_MICROMIPS_26_S1,
R_MICROMIPS_HI16, R_MICROMIPS_LO16, R_MICROMIPS_GPREL16,
R_MICROMIPS_LITERAL, R_MICROMIPS_GOT16, R_MICROMIPS_PC7_S1,
R_MICROMIPS_PC10_S1, R_MICROMIPS_PC16_S1, R_MICROMIPS_CALL16,
R_MICROMIPS_GOT_DISP, R_MICROMIPS_GOT_PAGE, R_MICROMIPS_GOT_OFST,
R_MICROMIPS_GOT_HI16, R_MICROMIPS_GOT_LO16, R_MICROMIPS_SUB,
R_MICROMIPS_HIGHER, R_MICROMIPS_HIGHEST, R_MICROMIPS_CALL_HI16,
R_MICROMIPS_CALL_LO16, R_MICROMIPS_SCN_DISP, R_MICROMIPS_JALR,
R_MICROMIPS_HI0_LO16, R_MICROMIPS_TLS_GD, R_MICROMIPS_TLS_LDM,
R_MICROMIPS_TLS_DTPREL_HI16, R_MICROMIPS_TLS_DTPREL_LO16,
R_MICROMIPS_TLS_GOTTPREL, R_MICROMIPS_TLS_TPREL_HI16,
R_MICROMIPS_TLS_TPREL_LO16, R_MICROMIPS_GPREL7_S2,
R_MICROMIPS_PC23_S20, R_MIPS_EH): New enums for relocations (mips16 and
micromips).
(STO_MIPS_FLAGS): New enum constant.
(elf_st_is_mips16): New function.
(elf_st_is_micromips): New function.
(is_micromips): New function.
(abi_n32): New function.
(abi_n64): New function.
(ODK_NULL, ODK_REGINFO, ODK_EXCEPTIONS, ODK_PAD, ODK_HWPATCH, ODK_FILL,
ODK_TAGS, ODK_HWAND, ODK_HWOR, ODK_GP_GROUP, ODK_IDENT): New enum
constants.
* elfcpp.h (SHT_MIPS_OPTIONS): New enum constant.
Keith Seitz [Tue, 15 Apr 2014 19:07:33 +0000 (12:07 -0700)]
Remove unused globals in mi-simplerun.exp.
2014-04-15 Keith Seitz <keiths@redhat.com>
* gdb.mi/mi-simplerun.exp (test_breakpoints_creation_and_listing):
Remove unused globals.
(test_running_the_program): Likewise.
(test_controlled_execution): Likewise.
(test_controlling_breakpoints): Likewise.
(test_program_termination): Likewise.
Cary Coutant [Tue, 15 Apr 2014 18:24:30 +0000 (11:24 -0700)]
Allow target to decide whether to include a section.
2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
gold/
* layout.cc (Layout::include_section): Allow a target to decide
whether to include a section.
* target.h (Target::should_include_section): New function.
(Target::do_should_include_section): New function.
Cary Coutant [Tue, 15 Apr 2014 18:19:18 +0000 (11:19 -0700)]
Allow target to derive from Copy_relocs class.
2014-04-15 Sasa Stankovic <Sasa.Stankovic@imgtec.com>
gold/
* copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
inline into ...
(Copy_relocs::emit): ... here.
* copy-relocs.h (Copy_reloc_entry): Change from class to struct.
(Copy_reloc_entry::make_copy_reloc): Change from private to protected.
(Copy_reloc_entry::entries_): Change from private to protected.
Keith Seitz [Tue, 15 Apr 2014 18:47:57 +0000 (11:47 -0700)]
Test suite cleanup.
2014-04-15 Keith Seitz <keiths@redhat.com>
* gdb.mi/mi-break.exp (test_tbreak_creation_and_listing): Remove
unused globals.
(test_rbreak_creation_and_listing): Likewise.
(test_ignore_count): Likewise.
(test_error): Likewise.
Marcus Shawcroft [Tue, 15 Apr 2014 16:46:07 +0000 (17:46 +0100)]
[AArch64] Fix off by one error in instruction relaxation mask.
The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to
ensure that destination register in a relaxed ldr instruction is
always X0. The mask has an off by one error resulting in the most
significant bit of the destination register being retained in the
relaxed instruction. The issue generally appears when the compiler
emits TLS accesses code under high register pressure resulting in a
broken code sequence.
Pedro Alves [Tue, 15 Apr 2014 13:02:34 +0000 (14:02 +0100)]
gdb.base/sym-file.exp, hide guts of the custom loader.
This test uses a simple custom elf loader, implemented in
gdb.base/sym-file-loader.h|c. This loader doesn't have a dlclose-like
function today, but I'll need one. But, I found that the guts of the
loader are exposed too much to the client, making the interface more
complicated than necessary. It's simpler if the loader just exports a
few dlopen/dlsym -style functions. That's what this patch does.
Tested on x86_86 Fedora 17, native and gdbserver.
gdb/testsuite/
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file-loader.h: Move inclusion of <inttypes.h>,
<ansidecl.h>, <elf/common.h> and <elf/external.h> to
sym-file-loader.c.
(Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr)
(Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move
to sym-file-loader.c.
(struct library): Forward declare.
(load_shlib, lookup_function): Change prototypes.
(find_shstrtab, find_strtab, find_shdr, find_symtab)
(translate_offset): Remove declarations.
(get_text_addr): New declaration.
* gdb.base/sym-file-loader.c: Move inclusion of <inttypes.h>,
<ansidecl.h>, <elf/common.h> and <elf/external.h> here from
sym-file-loader.h.
(Elf_External_Phdr, Elf_External_Ehdr, Elf_External_Shdr)
(Elf_External_Sym, Elf_Addr, GET, GETADDR, struct segment): Move
here from sym-file-loader.h.
(struct library): New structure.
(load_shlib, lookup_function): Change prototypes and adjust to
work with a struct library.
(find_shstrtab, find_strtab, find_shdr, find_symtab)
(translate_offset): Make static.
(get_text_addr): New function.
* gdb.base/sym-file-main.c (main): Adjust to new loader interface.
Pedro Alves [Tue, 15 Apr 2014 13:13:08 +0000 (14:13 +0100)]
gdb.base/sym-file-loader.c: Fix typo.
SELF_LINK, not SELK_LINK...
gdb/testsuite/
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file-loader.c: Fix typo. SELF_LINK, not SELK_LINK.
Pedro Alves [Mon, 14 Apr 2014 16:23:55 +0000 (17:23 +0100)]
Make sym-file.exp work with remote targets and hosts.
The main issue here is that this test passes the host's absolute path
to the library to load to the "dlopen"-like routine, which doesn't
work when either the target or the host are remote, unless a shared
filesystem has been set up.
Tests that dynamically load a library solve this by dlopen'ing by
basename, and setting rpath to $ORIGIN. See gdb_compile.
This test doesn't use dlopen, but instead uses its own simple elf
loader. The fix is to pass this loader the library basename, and
teach it to look up the library by basename in the executable's
directory as well, i.e., assuming/emulating RPATH=$ORIGIN.
Tested on x86_64 Fedora 17, native and gdbserver.
I looked around in the web to figure out Linux's /proc/self/exe
equivalents in other ELF OSs. I think I covered all relevant, but if
not, I think it'll be simple enough to add more. (Note the test is
skipped on non-ELF targets.)
Tested on x86_64 Fedora 17, native and gdbserver.
gdb/testsuite/
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file-loader.c: Include <limits.h>.
(SELF_LINK): New define.
(get_origin): New function.
(load_shlib): Use it.
* gdb.base/sym-file.exp: Don't early return if the target is
remote. Use runto_main, and issue fail is that fails. Use
gdb_load_shlibs.
(shlib_name): Delete.
(lib_so, lib_syms, lib_dlopen): New globals. Use them throughout.
Pedro Alves [Tue, 15 Apr 2014 11:49:51 +0000 (12:49 +0100)]
gdb.base/sym-file.exp: clean up test messages a bit.
Remove regex characters from test message, and don't refer to
breakpoint numbers in test messages (subsequent patches will add more
breakpoints, changing these numbers). Result:
-PASS: gdb.base/sym-file.exp: add-symbol-file .*sym-file-lib\.so addr
+PASS: gdb.base/sym-file.exp: add-symbol-file sym-file-lib.so addr
-PASS: gdb.base/sym-file.exp: check if Breakpoint 2 is pending.
-PASS: gdb.base/sym-file.exp: check if Breakpoint 3 is pending.
+PASS: gdb.base/sym-file.exp: breakpoint at foo is pending
+PASS: gdb.base/sym-file.exp: breakpoint at bar is pending
gdb/testsuite/
2014-04-15 Pedro Alves <palves@redhat.com>
* gdb.base/sym-file.exp: Remove regex characters from test
message. Don't refer to breakpoint numbers in test messages.
Alan Modra [Tue, 15 Apr 2014 00:00:44 +0000 (09:30 +0930)]
daily update
Keith Seitz [Mon, 14 Apr 2014 22:47:15 +0000 (15:47 -0700)]
Remove symbol_matches_domain. This fixes
PR c++/16253.
symbol_matches_domain was permitting searches for a VAR_DOMAIN
symbol to also match STRUCT_DOMAIN symbols for languages like C++
where STRUCT_DOMAIN symbols also define a typedef of the same name,
e.g., "struct foo {}" introduces a typedef of the name "foo".
Problems occur if there exists both a VAR_DOMAIN and STRUCT_DOMAIN
symbol of the same name. Then it is essentially a race between which
symbol is found first. The other symbol is obscurred.
[This is a relatively common idiom: enum e { ... } e;]
This patchset moves this "language defines a typedef" logic to
lookup_symbol[_in_language], looking first for a symbol in the given
domain and falling back to searching STRUCT_DOMAIN when/if appropriate.
2014-04-14 Keith Seitz <keiths@redhat.com>
PR c++/16253
* ada-lang.c (ada_symbol_matches_domain): Moved here and renamed
from symbol_matches_domain in symtab.c. All local callers
of symbol_matches_domain updated.
(standard_lookup): If DOMAIN is VAR_DOMAIN and no symbol is found,
search STRUCT_DOMAIN.
(ada_find_any_type_symbol): Do not search STRUCT_DOMAIN
independently. standard_lookup will do that automatically.
* cp-namespace.c (cp_lookup_symbol_nonlocal): Explain when/why
VAR_DOMAIN searches may return a STRUCT_DOMAIN match.
(cp_lookup_symbol_in_namespace): Likewise.
If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN.
(cp_lookup_symbol_exports): Explain when/why VAR_DOMAIN searches
may return a STRUCT_DOMAIN match.
(lookup_symbol_file): Search for the class name in STRUCT_DOMAIN.
* cp-support.c: Include language.h.
(inspect_type): Explicitly search STRUCT_DOMAIN before searching
VAR_DOMAIN.
* psymtab.c (match_partial_symbol): Compare the requested
domain with the symbol's domain directly.
(lookup_partial_symbol): Likewise.
* symtab.c (lookup_symbol_in_language): Explain when/why
VAR_DOMAIN searches may return a STRUCT_DOMAIN match.
If no VAR_DOMAIN symbol is found, search STRUCT_DOMAIN for
appropriate languages.
(symbol_matches_domain): Renamed `ada_symbol_matches_domain'
and moved to ada-lang.c
(lookup_block_symbol): Explain that this function only returns
symbol matching the requested DOMAIN.
Compare the requested domain with the symbol's domain directly.
(iterate_over_symbols): Compare the requested domain with the
symbol's domain directly.
* symtab.h (symbol_matches_domain): Remove.
2014-04-14 Keith Seitz <keiths@redhat.com>
PR c++/16253
* gdb.cp/var-tag.cc: New file.
* gdb.cp/var-tag.exp: New file.
* gdb.dwarf2/dw2-ada-
ffffffff.exp: Set the language to C++.
* gdb.dwarf2/dw2-anon-mptr.exp: Likewise.
* gdb.dwarf2/dw2-double-set-die-type.exp: Likewise.
* gdb.dwarf2/dw2-inheritance.exp: Likewise.
Tom Tromey [Thu, 27 Mar 2014 18:24:27 +0000 (12:24 -0600)]
implement support for "enum class"
This adds support for the C++11 "enum class" feature. This is
PR c++/15246.
I chose to use the existing TYPE_DECLARED_CLASS rather than introduce
a new type code. This seemed both simple and clear to me.
I made overloading support for the new enum types strict. This is how
it works in C++; and it didn't seem like an undue burden to keep this,
particularly because enum constants are printed symbolically by gdb.
Built and regtested on x86-64 Fedora 20.
2014-04-14 Tom Tromey <tromey@redhat.com>
PR c++/15246:
* c-exp.y (type_aggregate_p): New function.
(qualified_name, classify_inner_name): Use it.
* c-typeprint.c (c_type_print_base): Handle TYPE_DECLARED_CLASS
and TYPE_TARGET_TYPE of an enum type.
* dwarf2read.c (read_enumeration_type): Set TYPE_DECLARED_CLASS on
an enum type.
(determine_prefix) <case DW_TAG_enumeration_type>: New case;
handle TYPE_DECLARED_CLASS.
* gdbtypes.c (rank_one_type): Handle TYPE_DECLARED_CLASS on enum
types.
* gdbtypes.h (TYPE_DECLARED_CLASS): Update comment.
* valops.c (enum_constant_from_type): New function.
(value_aggregate_elt): Use it.
* cp-namespace.c (cp_lookup_nested_symbol): Handle
TYPE_CODE_ENUM.
2014-04-14 Tom Tromey <tromey@redhat.com>
* gdb.cp/classes.exp (test_enums): Handle underlying type.
* gdb.dwarf2/enum-type.exp: Add test for enum with underlying
type.
* gdb.cp/enum-class.exp: New file.
* gdb.cp/enum-class.cc: New file.
Tom Tromey [Thu, 27 Mar 2014 18:16:38 +0000 (12:16 -0600)]
constify value_aggregate_elt
While working on another patch I realized that value_aggregate_elt's
"name" parameter ought to be const. This patch implements this.
2014-04-14 Tom Tromey <tromey@redhat.com>
* valops.c (value_aggregate_elt, value_struct_elt_for_reference)
(value_namespace_elt, value_maybe_namespace_elt): Make "name"
const.
* value.h (value_aggregate_elt): Update.
Tom Tromey [Wed, 26 Mar 2014 14:54:56 +0000 (08:54 -0600)]
handle DW_AT_type on an enumeration
DWARF allows an enumeration type to have a DW_AT_type. GDB doesn't
recognize this, but there is a patch to change GCC to emit it, and a
DWARF proposal to further allow an enum type with a DW_AT_type to omit
the DW_AT_byte_size. This patch changes gdb to implement this.
Built and regtested on x86-64 Fedora 20.
2014-04-14 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (read_enumeration_type): Handle DW_AT_type.
2014-04-14 Tom Tromey <tromey@redhat.com>
* gdb.dwarf2/enum-type.exp: New file.
Sanimir Agovic [Fri, 15 Nov 2013 12:48:00 +0000 (12:48 +0000)]
test: add mi vla test
testsuite/ChangeLog:
* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:47 +0000 (12:47 +0000)]
test: basic c99 vla tests for C primitives
gdb/testsuite/ChangeLog:
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:44 +0000 (12:47 +0000)]
test: evaluate pointers to C99 vla correctly.
gdb/testsuite/ChangeLog:
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.
Sanimir Agovic [Tue, 26 Nov 2013 14:47:16 +0000 (14:47 +0000)]
test: cover subranges with present DW_AT_count attribute
The dwarf attribute DW_AT_count specifies the elements of a subrange.
This test covers subranges with present count but absent upper bound
attribute, both with static and dynamic attribute values.
testsuite/ChangeLog:
* gdb.dwarf2/count.exp: New file.
Sanimir Agovic [Wed, 5 Feb 2014 16:22:08 +0000 (16:22 +0000)]
vla: evaluate operand of sizeof if its type is a vla
The c99 standard in "6.5.3.4 The sizeof operator" states:
If the type of the operand is a variable length array type, the operand
is evaluated;[...]
This patch mirrors the following c99 semantic in gdb:
1| int vla[n][m];
2| int i = 1;
3| sizeof(vla[i++][0]); // No sideffect
4| assert (i == 1);
5| sizeof(vla[i++]); // With sideffect
6| assert (i == 2);
Note: ptype/whatis still do not allow any sideeffects.
This patch was motivated by:
https://sourceware.org/ml/gdb-patches/2014-01/msg00732.html
gdb/ChangeLog:
* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.
testsuite/ChangeLog:
* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.
Sanimir Agovic [Tue, 26 Nov 2013 14:35:43 +0000 (14:35 +0000)]
vla: resolve dynamic bounds if value contents is a constant byte-sequence
A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.
gdb/ChangeLog:
* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.
Sanimir Agovic [Tue, 19 Nov 2013 12:54:24 +0000 (12:54 +0000)]
vla: support for DW_AT_count
This patch adds support for DW_AT_count as requested in the code review:
https://sourceware.org/ml/gdb-patches/2013-11/msg00200.html
gdb/ChangeLog:
* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.
Sanimir Agovic [Thu, 14 Nov 2013 09:55:52 +0000 (09:55 +0000)]
vla: print "variable length" for unresolved dynamic bounds
1| void foo (size_t n) {
2| int vla[n];
3| }
Given the following expression
(gdb) ptype &vla
Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:
type = int (*)[
1289346]
this patch deals with this case and prints:
type = int (*)[variable length]
instead.
gdb/ChangeLog:
* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.
Sanimir Agovic [Mon, 14 Oct 2013 07:36:13 +0000 (08:36 +0100)]
vla: update type from newly created value
Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.
gdb/ChangeLog
* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.
Sanimir Agovic [Sat, 12 Oct 2013 11:36:16 +0000 (12:36 +0100)]
vla: enable sizeof operator for indirection
This patch enables the sizeof operator for indirections:
1| void foo (size_t n) {
2| int vla[n];
3| int *vla_ptr = &vla;
4| }
(gdb) p sizeof(*vla_ptr)
yields sizeof (size_t) * n.
gdb/ChangeLog:
* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
vla: enable sizeof operator to work with variable length arrays
In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.
We now are able to get the size of a vla:
1| void foo (size_t n) {
2| int vla[n];
3| }
(gdb) p sizeof(vla)
yields N * sizeof(int).
gdb/ChangeLog:
* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
type: add c99 variable length array support
The dwarf standard allow certain attributes to be expressed as dwarf
expressions rather than constants. For instance upper-/lowerbound attributes.
In case of a c99 variable length array the upperbound is a dynamic attribute.
With this change c99 vla behave the same as with static arrays.
1| void foo (size_t n) {
2| int ary[n];
3| memset(ary, 0, sizeof(ary));
4| }
(gdb) print ary
$1 = {0 <repeats 42 times>}
gdb/ChangeLog:
* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.
David Blaikie [Sat, 12 Apr 2014 00:20:49 +0000 (17:20 -0700)]
Add return value for non-void function return statements to fix error in clang build.
Clang defaults this warning to an error, breaking the build & causing
these tests not to run.
gdb/testsuite/
* gdb.mi/non-stop.c: Add return value for non-void function return
statement.
* gdb.threads/staticthreads.c: Ditto.
Richard Henderson [Mon, 14 Apr 2014 15:30:56 +0000 (08:30 -0700)]
Fix typo in _initialize_alpha_linux_nat prototype
* alpha-linux-nat.c (_initialize_alpha_linux_nat): Fix prototype.
Alan Modra [Mon, 14 Apr 2014 02:18:06 +0000 (11:48 +0930)]
ppc476 plt call stubs
Fuss over bctr in call stubs.
* elf32-ppc.c (BA): Define
(ppc_elf_link_hash_table_create): Correct default_params.
(write_glink_stub): Pad small plt call stub with "ba 0" rather
than "nop" for ppc476_workaround.
(ppc_elf_finish_dynamic_sections): Likewise for branch table
and __glink_PLTresolve. Ensure plt call stub at end of page
doesn't allow fall-thru prefetch.
Alan Modra [Mon, 14 Apr 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Alan Modra [Sun, 13 Apr 2014 00:00:41 +0000 (09:30 +0930)]
daily update
Doug Evans [Sat, 12 Apr 2014 16:09:41 +0000 (09:09 -0700)]
Copy over fix for fetching dynamic type of a reference from python side.
* guile/scm-value.c (gdbscm_value_dynamic_type): Use coerce_ref to
dereference TYPE_CODE_REF values.
testsuite/
* gdb.guile/scm-value.c: Improve test case.
* gdb.guile/scm-value.exp: Add new test.
David Blaikie [Fri, 11 Apr 2014 19:45:37 +0000 (12:45 -0700)]
Compile inline test with -std=gnu89 explicitly to override Clang's default (-std=c99)
gdb/testsuite/
* gdb.opt/inline-break.exp: Explicitly specify -std=gnu89 to
override Clang's default.
Alan Modra [Sat, 12 Apr 2014 00:00:56 +0000 (09:30 +0930)]
daily update
Joel Brobecker [Fri, 11 Apr 2014 22:28:08 +0000 (15:28 -0700)]
gdb/testsuite/ChangeLog: Fix path to a few files in previous entries.
Joel Brobecker [Fri, 11 Apr 2014 21:47:15 +0000 (14:47 -0700)]
Revert the entire VLA series.
This reverts the following patch series, as they cause some regresssions.
commit
37c1ab67a35025d37d42c449deab5f254f9f59da
type: add c99 variable length array support
gdb/
* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.
commit
26cb189f8b46dbe7b2d485525329a8919005ca8a
vla: enable sizeof operator to work with variable length arrays
gdb/
* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.
commit
04b19544ef6a97b62b2cc4a3170b900e046ab185
vla: enable sizeof operator for indirection
gdb/
* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.
commit
bcd629a44fff61527430f353cf77e20fe3afc395
vla: update type from newly created value
gdb/
* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* eval.c (evaluate_subexp_with_coercion): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.
commit
b86138fb0484f42db6cb83abed1e3d0ad2ec4eac
vla: print "variable length" for unresolved dynamic bounds
gdb/
* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.
commit
e1969afbd454c09c3aad1990305715f70bc47c3c
vla: support for DW_AT_count
gdb/
* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.
commit
92b09522dc5a93ba4bda3c1c0b3c58264e357c8a
vla: resolve dynamic bounds if value contents is a constant byte-sequence
gdb/
* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.
commit
3bce82377f683870cc89925ff43aefb7dcce4a77
vla: evaluate operand of sizeof if its type is a vla
gdb/
* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.
gdb/testsuite
* gdb.base/vla-sideeffect.c: New file.
* gdb.base/vla-sideeffect.exp: New file.
commit
504f34326e5ae7c78ebfcdd6ed03c7403b42048b
test: cover subranges with present DW_AT_count attribute
gdb/testsuite/
* gdb.dwarf2/count.exp: New file.
commit
1a237e0ee53bbdee97d72d794b5b42e774cc81c0
test: multi-dimensional c99 vla.
gdb/testsuite/
* gdb.base/vla-multi.c: New file.
* gdb.base/vla-multi.exp: New file.
commit
024e13b46f9c33d151ae82fd9d64c53092fd9313
test: evaluate pointers to C99 vla correctly.
gdb/testsuite/
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.
commit
c8655f75e2f0fada311be193e3090087a77ec802
test: basic c99 vla tests for C primitives
gdb/testsuite/
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.
commit
58a84dcf29b735ee776536b4c51ba90b51612b71
test: add mi vla test
gdb/testsuite/
* gdb.mi/mi-vla-c99.exp: New file.
* gdb.mi/vla.c: New file.
Keith Seitz [Fri, 11 Apr 2014 21:17:17 +0000 (14:17 -0700)]
Fix c++/16675 -- sizeof reference type should give the size of
the referent, not the size of the actual reference variable.
Nick Clifton [Fri, 11 Apr 2014 15:02:52 +0000 (16:02 +0100)]
PE32+ binaries that use addresses > 1^32 have a problem in that the linker
converts some address expressions into absolute values, but the PE format
only stores absolutes as 32-bits. This is a partial solution which attempts
to convert such absolute values back to section relative ones instead. It
fails for symbols like __image_base and ImageBase__, but it is unclear as to
whether these values are ever actually used by applications.
PR ld/16821
* peXXigen.c (abs_finder): New function.
(_bfd_XXi_swap_sym_out): For absolute symbols with values larger
than 1^32 try to convert them into section relative values
instead.
Sanimir Agovic [Fri, 15 Nov 2013 12:48:00 +0000 (12:48 +0000)]
test: add mi vla test
testsuite/gdb.mi/
* mi-vla-c99.exp: New file.
* vla.c: New file.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:47 +0000 (12:47 +0000)]
test: basic c99 vla tests for C primitives
gdb/testsuite:
* gdb.base/vla-datatypes.c: New file.
* gdb.base/vla-datatypes.exp: New file.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:44 +0000 (12:47 +0000)]
test: evaluate pointers to C99 vla correctly.
gdb/testsuite:
* gdb.base/vla-ptr.c: New file.
* gdb.base/vla-ptr.exp: New file.
Sanimir Agovic [Fri, 15 Nov 2013 12:47:32 +0000 (12:47 +0000)]
test: multi-dimensional c99 vla.
gdb/testsuite:
* gdb.base/vla-multi.c: New file.
* gdb.base/vla-multi.exp: New file.
Sanimir Agovic [Tue, 26 Nov 2013 14:47:16 +0000 (14:47 +0000)]
test: cover subranges with present DW_AT_count attribute
The dwarf attribute DW_AT_count specifies the elements of a subrange.
This test covers subranges with present count but absent upper bound
attribute, both with static and dynamic attribute values.
testsuite:
* gdb.dwarf2/count.exp: New file.
Sanimir Agovic [Wed, 5 Feb 2014 16:22:08 +0000 (16:22 +0000)]
vla: evaluate operand of sizeof if its type is a vla
The c99 standard in "6.5.3.4 The sizeof operator" states:
If the type of the operand is a variable length array type, the operand
is evaluated;[...]
This patch mirrors the following c99 semantic in gdb:
1| int vla[n][m];
2| int i = 1;
3| sizeof(vla[i++][0]); // No sideffect
4| assert (i == 1);
5| sizeof(vla[i++]); // With sideffect
6| assert (i == 2);
Note: ptype/whatsis still do not allow any sideeffects.
This patch was motivated by:
https://sourceware.org/ml/gdb-patches/2014-01/msg00732.html
* eval.c (evaluate_subexp_for_sizeof): Add enum noside argument.
(evaluate_subexp_standard): Pass noside argument.
(evaluate_subexp_for_sizeof) <BINOP_SUBSCRIPT>: Handle subscript case
if noside equals EVAL_NORMAL. If the subscript yields a vla type
re-evaluate subscript operation with EVAL_NORMAL to enable sideffects.
* gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated.
* gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case.
testsuite/gdb.base/
* vla-sideeffect.c: New file.
* vla-sideeffect.exp: New file.
Sanimir Agovic [Tue, 26 Nov 2013 14:35:43 +0000 (14:35 +0000)]
vla: resolve dynamic bounds if value contents is a constant byte-sequence
A variable location might be a constant value and therefore no inferior memory
access is needed to read the content. In this case try to resolve the type
bounds.
* findvar.c (default_read_var_value): Resolve dynamic bounds if location
points to a constant blob.
Sanimir Agovic [Tue, 19 Nov 2013 12:54:24 +0000 (12:54 +0000)]
vla: support for DW_AT_count
This patch adds support for DW_AT_count as requested in the code review:
https://sourceware.org/ml/gdb-patches/2013-11/msg00200.html
* dwarf2read.c (read_subrange_type): Convert DW_AT_count to a dynamic
property and store it as the high bound and flag the range accordingly.
* gdbtypes.c (resolve_dynamic_bounds): If range is flagged as
RANGE_UPPER_BOUND_IS_COUNT assign low + high - 1 as the new high bound.
* gdbtypes.h (enum range_flags): New enum.
(struct range_bounds): Add flags member.
Sanimir Agovic [Thu, 14 Nov 2013 09:55:52 +0000 (09:55 +0000)]
vla: print "variable length" for unresolved dynamic bounds
1| void foo (size_t n) {
2| int vla[n];
3| }
Given the following expression
(gdb) ptype &vla
Gdb evaluates the expression with EVAL_AVOID_SIDE_EFFECTS and thus
does not resolve the bounds information and misinterprets the high
bound as a constant. The current output is:
type = int (*)[
1289346]
this patch deals with this case and prints:
type = int (*)[variable length]
instead.
* c-typeprint.c (c_type_print_varspec_suffix): Added
check for not yet resolved high bound. If unresolved, print
"variable length" string to the console instead of random
length.
Sanimir Agovic [Mon, 14 Oct 2013 07:36:13 +0000 (08:36 +0100)]
vla: update type from newly created value
Constructing a value based on a type and address might change the type
of the newly constructed value. Thus re-fetch type via value_type to ensure
we have the correct type at hand.
* ada-lang.c (ada_value_primitive_packed_val): Re-fetch type from value.
(ada_template_to_fixed_record_type_1): Likewise.
(ada_to_fixed_type_1): Likewise.
* cp-valprint.c (cp_print_value_fields_rtti): Likewise.
(cp_print_value): Likewise.
* d-valprint.c (dynamic_array_type): Likewise.
* eval.c (evaluate_subexp_with_coercion): Likewise.
* findvar.c (address_of_variable): Likewise.
* jv-valprint.c (java_value_print): Likewise.
* valops.c (value_ind): Likewise.
* value.c (coerce_ref): Likewise.
Sanimir Agovic [Sat, 12 Oct 2013 11:36:16 +0000 (12:36 +0100)]
vla: enable sizeof operator for indirection
This patch enables the sizeof operator for indirections:
1| void foo (size_t n) {
2| int vla[n];
3| int *vla_ptr = &vla;
4| }
(gdb) p sizeof(*vla_ptr)
yields sizeof (size_t) * n.
* eval.c (evaluate_subexp_for_sizeof) <UNOP_IND>: Create an indirect
value and retrieve the dynamic type size.
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
vla: enable sizeof operator to work with variable length arrays
In C99 the sizeof operator computes the size of a variable length array
at runtime (6.5.3.4 The sizeof operator). This patch reflects the semantic
change in the debugger.
We now are able to get the size of a vla:
1| void foo (size_t n) {
2| int vla[n];
3| }
(gdb) p sizeof(vla)
yields N * sizeof(int).
* eval.c (evaluate_subexp_for_sizeof) <OP_VAR_VALUE>: If the type
passed to sizeof is dynamic evaluate the argument to compute the length.
Sanimir Agovic [Wed, 9 Oct 2013 14:28:22 +0000 (15:28 +0100)]
type: add c99 variable length array support
The dwarf standard allow certain attributes to be expressed as dwarf
expressions rather than constants. For instance upper-/lowerbound attributes.
In case of a c99 variable length array the upperbound is a dynamic attribute.
With this change c99 vla behave the same as with static arrays.
1| void foo (size_t n) {
2| int ary[n];
3| memset(ary, 0, sizeof(ary));
4| }
(gdb) print ary
$1 = {0 <repeats 42 times>}
* dwarf2loc.c (dwarf2_locexpr_baton_eval): New function.
(dwarf2_evaluate_property): New function.
* dwarf2loc.h (dwarf2_evaluate_property): New function prototype.
* dwarf2read.c (attr_to_dynamic_prop): New function.
(read_subrange_type): Use attr_to_dynamic_prop to read high bound
attribute.
* gdbtypes.c: Include dwarf2loc.h.
(is_dynamic_type): New function.
(resolve_dynamic_type): New function.
(resolve_dynamic_bounds): New function.
(get_type_length): New function.
(check_typedef): Use get_type_length to compute type length.
* gdbtypes.h (TYPE_HIGH_BOUND_KIND): New macro.
(TYPE_LOW_BOUND_KIND): New macro.
(is_dynamic_type): New function prototype.
* value.c (value_from_contents_and_address): Call resolve_dynamic_type
to resolve dynamic properties of the type. Update comment.
* valops.c (get_value_at, value_at, value_at_lazy): Update comment.
Sanimir Agovic [Tue, 8 Oct 2013 14:04:49 +0000 (15:04 +0100)]
vla: introduce new bound type abstraction adapt uses
The rational behind this patch is to get started to implement the feature
described in dwarf4 standard (2.19) Static and Dynamic Values of Attributes.
It adds new BOUND_PROP to store either a constant, exprloc, or reference to
describe an upper-/lower bound of a subrange. Other than that no new features
are introduced.
* dwarf2read.c (read_subrange_type): Use struct bound_prop for
declaring high/low bounds and change uses accordingly. Call
create_range_type instead of create_static_range_type.
* gdbtypes.c (create_range_type): New function.
(create_range_type): Convert bounds into struct bound_prop and pass
them to create_range_type.
* gdbtypes.h (struct bound_prop): New struct.
(create_range_type): New function prototype.
(struct range_bounds): Use struct bound_prop instead of LONGEST for
high/low bounds. Remove low_undefined/high_undefined and adapt all uses.
(TYPE_LOW_BOUND,TYPE_HIGH_BOUND): Adapt macros to refer to the static
part of the bound.
* parse.c (follow_types): Set high bound kind to BOUND_UNDEFINED.
Sanimir Agovic [Thu, 19 Dec 2013 08:31:17 +0000 (08:31 +0000)]
refactoring: rename create_range_type to create_static_range_type
* gdbtypes.c (create_static_range_type): Renamed from create_range_type.
* gdbtypes.h (create_static_range_type): Renamed from create_range_type.
* ada-lang.c: All uses of create_range_type updated.
* coffread.c: All uses of create_range_type updated.
* dwarf2read.c: All uses of create_range_type updated.
* f-exp.y: All uses of create_range_type updated.
* m2-valprint.c: All uses of create_range_type updated.
* mdebugread.c: All uses of create_range_type updated.
* stabsread.c: All uses of create_range_type updated.
* valops.c: All uses of create_range_type updated.
* valprint.c: All uses of create_range_type updated.
Nick Clifton [Fri, 11 Apr 2014 11:39:03 +0000 (12:39 +0100)]
Regenerate header files after this commit:
2014-04-10 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations
Yao Qi [Wed, 2 Apr 2014 04:44:22 +0000 (12:44 +0800)]
Check file exists before completion tests
Doug told me that there are some regressions in gdb.base/completion.exp.
They are caused by my recent change, and can be reproduced via:
$ make check-parallel TESTS=gdb.base/completion.exp
FAIL: gdb.base/completion.exp: complete target core ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target tfile ./gdb.base/completion
FAIL: gdb.base/completion.exp: complete target exec ./gdb.base/completion
Current tests assume that gdb.base/completion exists but that is wrong
in a parallel run, because binary file and object files are placed
in outputs/gdb.base/completion/.
This patch is to check file exists on two candidate directories,
"gdb.base" and "outputs/gdb.base/completion/", and run tests with files
existed in either of them.
gdb/testsuite:
2014-04-11 Yao Qi <yao@codesourcery.com>
* gdb.base/completion.exp: Check file exists before running tests
on file completion.
Sandra Loosemore [Fri, 11 Apr 2014 00:14:18 +0000 (17:14 -0700)]
Ignore non-stub sections for nios2 stub_bfd processing.
2014-04-10 Cesar Philippidis <cesar@codesourcery.com>
bfd/
* elf32-nios2.c (nios2_elf32_build_stubs): Ignore dynobjs
when building function stubs.
Alan Modra [Fri, 11 Apr 2014 00:00:57 +0000 (09:30 +0930)]
daily update
Pedro Alves [Thu, 10 Apr 2014 18:22:23 +0000 (19:22 +0100)]
Conditional Z1 breakpoint hangs GDBserver.
While trying to fix hbreak2.exp against GDBserver I noticed this...
(gdb) hbreak main if 1
Sending packet: $m400580,40#2e...Packet received: e8d2ffffff5dc3554889e54883ec10c745fc00000000eb0eb800000000e8c1ffffff8345fc01817dfce70300007ee9b800000000c9c3662e0f1f840000000000
Sending packet: $m40058f,1#31...Packet received: c7
Hardware assisted breakpoint 1 at 0x40058f: file ../../../src/gdb/testsuite/gdb.base/break-idempotent.c, line 46.
Sending packet: $Z1,40058f,1;X3,220127#9b...
*hangs forever*
The issue is that nothing advances the packet pointer if
add_breakpoint_condition either fails to parse the agent expression,
or fails to find the breakpoint, resulting in an infinite loop in
process_point_options. The latter case should really be fixed by
GDBserver tracking GDB Z1 breakpoints in its breakpoint structures
like Z0 breakpoints are, but the latter case still needs handling.
add_breakpoint_commands has the same issue, though at present I don't
know any way to trigger it other than sending a manually cooked
packet.
Unbelievably, it doesn't look like we have any test that tries setting
a conditional hardware breakpoint. Looking at cond-eval-mode.exp, it
looks like the file was meant to actually test something, but it's
mostly empty today. This patch adds tests that tries all sorts of
conditional breakpoints and watchpoints. The test hangs/fails without
the GDBserver fix.
Tested on x86_64 Fedora 17.
gdb/gdbserver/
2014-04-10 Pedro Alves <palves@redhat.com>
* mem-break.c (add_breakpoint_condition, add_breakpoint_commands):
Check if the condition or command is NULL before checking if the
breakpoint is known. On success, return true.
* mem-break.h (add_breakpoint_condition): Document return.
(add_breakpoint_commands): Add describing comment.
* server.c (skip_to_semicolon): New function.
(process_point_options): Use it.
gdb/testsuite/
2014-04-10 Pedro Alves <palves@redhat.com>
* gdb.base/cond-eval-mode.c: New file.
* gdb.base/cond-eval-mode.exp: Use standard_testfile. Adjust
prepare_for_testing to build the new file. Check result of
runto_main.
(test_break, test_watch): New procedures.
(top level): Use them.
Denis Chertykov [Thu, 10 Apr 2014 15:50:33 +0000 (19:50 +0400)]
bfd/ChangeLog
* elf32-avr.c: Add DIFF relocations for AVR.
(avr_final_link_relocate): Handle the DIFF relocs.
(bfd_elf_avr_diff_reloc): New.
(elf32_avr_is_diff_reloc): New.
(elf32_avr_adjust_diff_reloc_value): Reduce difference value.
(elf32_avr_relax_delete_bytes): Recompute difference after deleting
bytes.
* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations
gas/ChangeLog
* config/tc-avr.c: Add new flag mlink-relax.
(md_show_usage): Add flag and help text.
(md_parse_option): Record whether link relax is turned on.
(relaxable_section): New.
(avr_validate_fix_sub): New.
(avr_force_relocation): New.
(md_apply_fix): Generate DIFF reloc.
(avr_allow_local_subtract): New.
* config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0.
(TC_FORCE_RELOCATION): Define.
(TC_FORCE_RELOCATION_SUB_SAME): Define.
(TC_VALIDATE_FIX_SUB): Define.
(avr_force_relocation): Declare.
(avr_validate_fix_sub): Declare.
(md_allow_local_subtract): Define.
(avr_allow_local_subtract): Declare.
gas/testsuite/ChangeLog
* gas/avr/diffreloc_withrelax.d: New testcase.
* gas/avr/noreloc_withoutrelax.d: Likewise.
* gas/avr/relax.s: Likewise.
include/ChangeLog
* elf/avr.h: Add new DIFF relocs.
ld/testsuite/ChangeLog
* ld-avr/norelax_diff.d: New testcase.
* ld-avr/relax_diff.d: Likewise.
* ld-avr/relax.s: Likewise.
Pedro Alves [Thu, 10 Apr 2014 13:19:52 +0000 (14:19 +0100)]
breakpoint shadowing, take single-step breakpoints into account.
Breakpoints are supposed to be transparent to memory accesses. For
all kinds of breakpoints breakpoint_xfer_memory hides the breakpoint
instructions. However, sss breakpoints aren't tracked like all other
breakpoints, and nothing is taking care of hiding them from memory
reads.
Say, as is, a background step + disassemble will see breakpoints
instructions on software step targets. E.g., stepping over this line:
while (1);
with s&
and then "disassemble" would show sss breakpoints.
Actually, that's still not be possible to see today, because:
- in native Linux, you can't read memory while the program
is running.
- with Linux gdbserver, you can, but in the all-stop RSP you
can't talk to the server while the program is running...
- and with non-stop, on software step targets, we presently
force the use of displaced-stepping for all single-steps,
so no single-step breakpoints are used...
I've been working towards making non-stop not force displaced stepping
on sss targets, and I noticed the issue then. With that, I indeed see
this:
(gdb) set remote Z-packet off
(gdb) s&
(gdb) disassemble main
Dump of assembler code for function main:
0x000000000040049c <+0>: push %rbp
0x000000000040049d <+1>: mov %rsp,%rbp
0x00000000004004a0 <+4>: int3
0x00000000004004a1 <+5>: (bad)
End of assembler dump.
Instead of the correct:
(gdb) disassemble main
Dump of assembler code for function main:
0x000000000040049c <+0>: push %rbp
0x000000000040049d <+1>: mov %rsp,%rbp
0x00000000004004a0 <+4>: jmp 0x4004a0 <main+4>
This is actually one thing that my v1 of the recent "fix a bunch of
run control bugs" series was fixing, because it made sss breakpoints
be regular breakpoints in the breakpoint chain. But dropped it in the
version that landed in the tree, due to some problems.
So instead of making sss breakpoints regular breakpoints, go with a
simpler fix (at least for now) -- make breakpoint_xfer_memory take
software single-step breakpoints into account. After the patch, I get
the correct disassemble output.
Tested on x86_64 Fedora 17, and also on top of my "use software
single-step on x86" series.
Also fixes the issue pointed out by Yao at
https://sourceware.org/ml/gdb-patches/2014-04/msg00045.html, where the
prologue analysis/frame sniffing manages to see software step
breakpoint instructions.
gdb/
2014-04-10 Pedro Alves <palves@redhat.com>
* breakpoint.c (single_step_breakpoints)
(single_step_gdbarch): Move up in the file.
(one_breakpoint_xfer_memory): New function, factored out from ...
(breakpoint_xfer_memory): ... here. Also process single-step
breakpoints.
Andrew Bennett [Tue, 8 Apr 2014 13:50:42 +0000 (14:50 +0100)]
Add support for the MIPS P5600 family of CPUs.
ChangeLog:
2014-04-10 Andrew Bennett <andrew.bennett@imgtec.com>
* config/tc-mips.c (mips_cpu_info_table): Add P5600
configuation.
* doc/c-mips.texi: Document p5600.