deliverable/binutils-gdb.git
10 years agopsymtab cleanup patch 3/3
Doug Evans [Wed, 15 Jan 2014 02:36:33 +0000 (18:36 -0800)] 
psymtab cleanup patch 3/3

This last patch removes "partial" from the names of
expand_partial_symbol_names and map_partial_symbol_filenames.
It also renames expand_partial_symbol_names to match the
struct quick_symbol_functions "method" that it wraps:
expand_symtabs_matching.

This patch also adds two parameters to expand_symtabs_matching
so that it can fully wrap the underlying quick_symbol_functions method.
This makes it usable in more places.
I thought of having a cover function that still had the same
signature as the old expand_partial_symbol_names function,
but I couldn't think of a good name, and it wasn't clear it was
worth it anyway.

* symfile.h (expand_symtabs_matching): Renamed from
expand_partial_symbol_names.  Update prototype.
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
* symfile.c (expand_symtabs_matching): Renamed from
expand_partial_symbol_names.  New args file_matcher, kind.
Rename arg fun to symbol_matcher.
(map_symbol_filenames): Renamed from map_partial_symbol_filenames.
* ada-lang.c (ada_complete_symbol_matcher): Renamed from
ada_expand_partial_symbol_name.
(ada_make_symbol_completion_list): Update to call
expand_symtabs_matching.
(ada_add_global_exceptions): Call expand_symtabs_matching.
* mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update to
call map_symbol_filenames.
* symtab.c (sources_info): Update to call map_symbol_filenames.
(search_symbols): Call expand_symtabs_matching.
(symbol_completion_matcher): Renamed from expand_partial_symbol_name.
(default_make_symbol_completion_list_break_on): Update to call
expand_symtabs_matching.
(make_source_files_completion_list): Update to call
map_symbol_filenames.

10 years agopsymtab cleanup patch 2/3
Doug Evans [Wed, 15 Jan 2014 02:30:31 +0000 (18:30 -0800)] 
psymtab cleanup patch 2/3

This patch adds two typedefs:
expand_symtabs_file_matcher_ftype
expand_symtabs_symbol_matcher_ftype

It also renames the NAME_MATCHER argument in expand_symtabs_matching.
The function is named expand_symtabs_matching and it takes a name_matcher
argument.  Name of what?  The symtab?  A symbol?
I made it SYMBOL_MATCHER to make it clearer.

* symfile.h (expand_symtabs_file_matcher_ftype): New typedef.
(expand_symtabs_symbol_matcher_ftype): New typedef.
(quick_symbol_functions.expand_symtabs_matching): Update to use.
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
* symfile.c (expand_partial_symbol_names): Update to use
expand_symtabs_symbol_matcher_ftype.
* dwarf2read.c (dw2_expand_symtabs_matching): Update to use
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
Arg name_matcher renamed to symbol_matcher.
* psymtab.c (recursively_search_psymtabs): Update to use
expand_symtabs_symbol_matcher_ftype.  Arg name_matcher renamed to
sym_matcher.
(expand_symtabs_matching_via_partial): Update to use
expand_symtabs_file_matcher_ftype, expand_symtabs_symbol_matcher_ftype.
Arg name_matcher renamed to symbol_matcher.

10 years agopsymtab cleanup patch 1/3
Doug Evans [Wed, 15 Jan 2014 02:19:51 +0000 (18:19 -0800)] 
psymtab cleanup patch 1/3

This is the first of a set of three patches to cleanup psymtab.c a bit.

Basically, these two functions do not belong in psymtab.c:
expand_partial_symbol_names, map_partial_symbol_filenames,
and "partial" does not belong in the function name.

This first patch moves them to a better location.
The second patch adds some typedefs for function parameters to
quick_symbol_functions.expand_symtabs_matching.
The third patch removes "partial" from the function names
and uses them in more places.

* psymtab.c (expand_partial_symbol_names): Delete, moved to symfile.c.
(map_partial_symbol_filenames): Ditto.
* psymtab.h (expand_partial_symbol_names): Delete, moved to symfile.h.
(map_partial_symbol_filenames): Ditto.
* symfile.c (expand_partial_symbol_names): Moved here from psymtab.c.
(map_partial_symbol_filenames): Ditto.
* symfile.h (expand_partial_symbol_names): Moved here from psymtab.h.
(map_partial_symbol_filenames): Ditto.
* symtab.c: Delete #include "psymtab.h".

10 years agoDon't discard relocs against __ehdr_start
H.J. Lu [Wed, 15 Jan 2014 00:42:35 +0000 (16:42 -0800)] 
Don't discard relocs against __ehdr_start

__ehdr_start will be defined by assign_file_positions_for_non_load_sections
later.

PR ld/16428
* elf32-i386.c (elf_i386_allocate_dynrelocs): Don't discard relocs
against __ehdr_start.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.

10 years agoRevert the last change
H.J. Lu [Wed, 15 Jan 2014 00:40:13 +0000 (16:40 -0800)] 
Revert the last change

* elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last
change.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.

10 years agodaily update
Alan Modra [Tue, 14 Jan 2014 23:00:50 +0000 (09:30 +1030)] 
daily update

10 years agoDon't update reloc count if there are any non pc-relative relocs
H.J. Lu [Tue, 14 Jan 2014 18:48:39 +0000 (10:48 -0800)] 
Don't update reloc count if there are any non pc-relative relocs

PR ld/16428
* elf32-i386.c (elf_i386_allocate_dynrelocs): Don't update reloc
count if there are any non pc-relative relocs.
* elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.

10 years agoFix "is a record target open" checks.
Pedro Alves [Tue, 14 Jan 2014 16:12:19 +0000 (16:12 +0000)] 
Fix "is a record target open" checks.

RECORD_IS_USED and record_full_open look at current_target.to_stratum
to determine whether a record target is in use.  This is wrong because
arch_stratum is greater than record_stratum, so if an arch_stratum
target is pushed, RECORD_IS_USED and record_full_open will miss it.

To fix this, we can use the existing find_record_target instead, which
looks up for a record stratum target across the target stack.  Since
that means exporting find_record_target in record.h, RECORD_IS_USED
ends up redundant, so the patch eliminates it.

That exercise then reveals other issues:

- adjust_pc_after_break is gating record_full_... calls based on
RECORD_IS_USED.  But, record_full_ calls shouldn't be made when
recording with the record-btrace target.  So this adds a new
record_full_is_used predicate to be used in that spot.

- record_full_open says "Process record target already running", even
if the recording target is record-btrace ("process record" is the
original complete name of the record-full target).  record_btrace_open
only says "The process is already being recorded." and does not
suggest "record stop", like record-full does.  The patch factors out
and merges that error to a new record_preopen function that all record
targets call in their open routine.

Tested on x86_64 Fedora 17.

gdb/
2014-01-14  Pedro Alves  <palves@redhat.com>
    Tom Tromey  <tromey@redhat.com>

* infrun.c (use_displaced_stepping): Use find_record_target
instead of RECORD_IS_USED.
(adjust_pc_after_break): Use record_full_is_used instead of
RECORD_IS_USED.
* record-btrace.c (record_btrace_open): Call record_preopen
instead of checking RECORD_IS_USED.
* record-full.c (record_full_shortname)
(record_full_core_shortname): New globals.
(record_full_is_used): New function.
(find_full_open): Call record_preopen instead of checking
RECORD_IS_USED.
(init_record_full_ops): Set the target's shortname to
record_full_shortname.
(init_record_full_core_ops): Set the target's shortname to
record_full_core_shortname.
* record-full.h (record_full_is_used): Declare.
* record.c (find_record_target): Make extern.
(record_preopen): New function.
* record.h (RECORD_IS_USED): Delete macro.
(find_record_target, record_preopen): Declare functions.

10 years ago2014-01-14 Michael Hudson-Doyle <michael.hudson@linaro.org>
Christophe Lyon [Tue, 14 Jan 2014 14:53:50 +0000 (15:53 +0100)] 
2014-01-14  Michael Hudson-Doyle  <michael.hudson@linaro.org>
    Kugan Vivekanandarajah  <kugan.vivekanandarajah@linaro.org>

bfd/
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use correct
offset while calculating relocation address.
(elfNN_aarch64_create_small_pltn_entry): Likewise.
(elfNN_aarch64_init_small_plt0_entry): Likewise.

10 years agoChange 'len''s type from LONGEST to ULONGEST: gdbarch methods core_xfer_shared_librar...
Yao Qi [Thu, 2 Jan 2014 07:36:55 +0000 (15:36 +0800)] 
Change 'len''s type from LONGEST to ULONGEST: gdbarch methods core_xfer_shared_libraries and core_xfer_shared_libraries_aix

This patch changes the type of 'len' from LONGEST to ULONGEST.  'len'
is the argument of gdbarch methods core_xfer_shared_libraries and
core_xfer_shared_libraries_aix.

gdb:

2014-01-14  Yao Qi  <yao@codesourcery.com>

* gdbarch.sh (core_xfer_shared_libraries): Change its argument
'len''s type to ULONGEST.
(core_xfer_shared_libraries_aix): Likewise.
* gdbarch.c, gdbarch.h: Reenerated.
* i386-cygwin-tdep.c (windows_core_xfer_shared_libraries):
Change type of 'len' to ULONGEST.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
(rs6000_aix_core_xfer_shared_libraries_aix): Likewise.

10 years agoChange 'len' of linux_common_xfer_osdata to ULONGEST.
Yao Qi [Fri, 3 Jan 2014 11:19:51 +0000 (19:19 +0800)] 
Change 'len' of linux_common_xfer_osdata to ULONGEST.

gdb:

2014-01-14  Yao Qi  <yao@codesourcery.com>

* common/linux-osdata.c (linux_xfer_osdata_processes): Change
type of 'len' to ULONGEST.
(linux_xfer_osdata_processgroups): Likewise.
(linux_xfer_osdata_threads): Likewise.
(linux_xfer_osdata_fds): Likewise.
(linux_xfer_osdata_isockets): Likewise.
(linux_xfer_osdata_shm): Likewise.
(linux_xfer_osdata_sem): Likewise.
(linux_xfer_osdata_msg): Likewise.
(linux_common_xfer_osdata): Likewise.
(struct osdata_type) <getter>: Likewise.
* common/linux-osdata.h (linux_common_xfer_osdata): Update
the declaration.

10 years agoChange to_xfer_partial 'len' type to ULONGEST.
Yao Qi [Fri, 3 Jan 2014 13:11:46 +0000 (21:11 +0800)] 
Change to_xfer_partial 'len' type to ULONGEST.

This patch changes to_xfer_partial's len's type to ULONGEST, and
adjust its implementations.

gdb:

2014-01-14  Yao Qi  <yao@codesourcery.com>

* target.h (target_xfer_partial_ftype): Update.
(struct target_ops) <to_xfer_partial>: Change 'len' type to
ULONGEST.
* aix-thread.c (aix_thread_xfer_partial): Change type of
argument 'len' to ULONGEST.
* auxv.c (procfs_xfer_auxv): Likewise.
(ld_so_xfer_auxv): Likewise.
(memory_xfer_auxv): Likewise.
* bfd-target.c (target_bfd_xfer_partial): Likewise.
* bsd-kvm.c (bsd_kvm_xfer_partial): Likewise.
* bsd-uthread.c (bsd_uthread_xfer_partial): Likewise.
* corelow.c (core_xfer_partial): Likewise.
* ctf.c (ctf_xfer_partial): Likewise.
* darwin-nat.c (darwin_read_write_inferior): Likewise.  Use
'%u'.
(darwin_read_dyld_info): Likewise.
(darwin_xfer_partial): Likewise.
* exec.c (section_table_xfer_memory_partial): Likewise.
(exec_xfer_partial): Likewise.
* exec.h (section_table_xfer_memory_partial): Update
declaration.
* gnu-nat.c (gnu_xfer_memory): Likewise.  Call pulongest
instead of plongest.
(gnu_xfer_partial): Likewise.
* ia64-hpux-nat.c (ia64_hpux_xfer_memory): Likewise.
(ia64_hpux_xfer_solib_got): Likewise.
(ia64_hpux_xfer_partial): Likewise.
* ia64-linux-nat.c (ia64_linux_xfer_partial):
* inf-ptrace.c (inf_ptrace_xfer_partial):
* inf-ttrace.c (inf_ttrace_xfer_partial):
* linux-nat.c (linux_xfer_siginfo): Likewise.
(linux_nat_xfer_partial): Likewise.
(spu_enumerate_spu_ids, linux_proc_xfer_spu): Likewise.
(linux_nat_xfer_osdata, linux_xfer_partial): Likewise.
* monitor.c (monitor_xfer_memory): Likewise.
(monitor_xfer_partial): Likewise.
* procfs.c (procfs_xfer_partial): Likewise.
* record-full.c (record_full_xfer_partial): Likewise.
(record_full_core_xfer_partial): Likewise.
* remote-sim.c (gdbsim_xfer_memory): Likewise.  Call pulongest
instead of plongest.
(gdbsim_xfer_partial): Likewise.
* remote.c (remote_xfer_partial): Likewise.
* rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise.
* rs6000-aix-tdep.h (rs6000_aix_ld_info_to_xml): Update
declaration.
* rs6000-nat.c (rs6000_xfer_partial): Likewise.
(rs6000_xfer_shared_libraries): Likewise.
* sol-thread.c (sol_thread_xfer_partial): Likewise.
* sparc-nat.c (sparc_xfer_wcookie): Likewise.
(sparc_xfer_partial): Likewise.
* spu-linux-nat.c (spu_proc_xfer_spu): Likewise.
(spu_xfer_partial): Likewise.
* spu-multiarch.c (spu_xfer_partial): Likewise.
* target.c (target_read_live_memory): Likewise.
(memory_xfer_live_readonly_partial): Likewise.
(memory_xfer_partial, memory_xfer_partial_1): Likewise.
(target_xfer_partial, default_xfer_partial): Likewise.
(current_xfer_partial): Likewise.
* tracepoint.c (tfile_xfer_partial): Likewise.
* windows-nat.c (windows_xfer_memory): Likewise.  Call
pulongest instead of plongest.
(windows_xfer_partial): Likewise.
(windows_xfer_shared_libraries): Likewise.

10 years agoUse target_xfer_partial_ftype for rs6000_xfer_shared_libraries
Yao Qi [Fri, 3 Jan 2014 02:33:44 +0000 (10:33 +0800)] 
Use target_xfer_partial_ftype for rs6000_xfer_shared_libraries

Hi,
We can use target_xfer_partial_ftype here for
rs6000_xfer_shared_libraries declaration.

gdb:

2014-01-14  Yao Qi  <yao@codesourcery.com>

* rs6000-nat.c (rs6000_xfer_shared_libraries): Use
target_xfer_partial_ftype.

10 years ago * lib/ld-lib.exp (default_ld_link): Remove support for ldflags.
Vidya Praveen [Tue, 14 Jan 2014 13:09:22 +0000 (13:09 +0000)] 
* lib/ld-lib.exp (default_ld_link): Remove support for ldflags.
(default_ld_simple_link): Likewise.

10 years ago PR gas/16434
Nick Clifton [Tue, 14 Jan 2014 12:39:45 +0000 (12:39 +0000)] 
PR gas/16434
* config/tc-z80.c (wrong_match): Provide format string to
as_warn.
(parse_exp_not_indexed): Delete unused variable dummy.
(emit_byte): Delete unused variable fixp.

10 years agoUse bitpos and type to lookup a gdb.Field object when its name is 'None'.
Siva Chandra [Fri, 27 Dec 2013 20:20:59 +0000 (12:20 -0800)] 
Use bitpos and type to lookup a gdb.Field object when its name is 'None'.

PR python/15464
PR python/16113
* valops.c (value_struct_elt_bitpos): New function
* py-type.c (convert_field): Set 'name' attribute of a gdb.Field
object to 'None' if the field name is an empty string ("").
* python/py-value.c (valpy_getitem): Use 'bitpos' and 'type'
attribute to look for a field when 'name' is 'None'.
(get_field_type): New function

testsuite/
* gdb.python/py-type.c: Enhance test case.
* gdb.python/py-value-cc.cc: Likewise
* gdb.python/py-type.exp: Add new tests.
* gdb.python/py-value-cc.exp: Likewise

10 years agoPR symtab/16426
Doug Evans [Tue, 14 Jan 2014 01:15:42 +0000 (17:15 -0800)] 
PR symtab/16426

* dwarf2read.c (dwarf2_get_dwz_file): Call gdb_bfd_record_inclusion.
(try_open_dwop_file): Ditto.
* gdb_bfd.c: #include "vec.h".
(bfdp): New typedef.
(struct gdb_bfd_data): New member included_bfds.
(gdb_bfd_unref): Unref all included bfds.
(gdb_bfd_record_inclusion): New function.
* gdb_bfd.h (gdb_bfd_record_inclusion): Declare.

10 years agodaily update
Alan Modra [Mon, 13 Jan 2014 23:00:39 +0000 (09:30 +1030)] 
daily update

10 years agoremove obsolete declaration
Tom Tromey [Mon, 30 Dec 2013 02:35:02 +0000 (19:35 -0700)] 
remove obsolete declaration

deprecated_core_resize_section_table is declared but never defined.
This patch removes the stale declaration.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* gdbcore.h (deprecated_core_resize_section_table): Remove.

10 years agoremove use_windows
Tom Tromey [Sat, 28 Dec 2013 22:11:36 +0000 (15:11 -0700)] 
remove use_windows

Nothing actually uses use_windows, not even Insight.  So, this patch
removes it.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* defs.h (use_windows): Remove.
* gdb.c (main): Update.
* main.c (captured_main, gdb_main): Update.
* main.h (struct captured_main_args) <use_windows>: Remove.
* top.c (use_windows): Remove.

10 years agoremove unused deprecated_flush_hook declaration
Tom Tromey [Sat, 28 Dec 2013 21:43:25 +0000 (14:43 -0700)] 
remove unused deprecated_flush_hook declaration

deprecated_flush_hook is declared in defs.h but never defined.
This patch removes the stale declaration.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* defs.h (deprecated_flush_hook): Remove.

10 years agoFix set auto-load safe-path false warning regression (PR 16216)
Jan Kratochvil [Mon, 13 Jan 2014 20:19:18 +0000 (21:19 +0100)] 
Fix set auto-load safe-path false warning regression (PR 16216)

gdb/
2014-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR threads/16216
* linux-thread-db.c (try_thread_db_load): Add parameter
check_auto_load_safe.  Move here the file_is_auto_load_safe call.
(try_thread_db_load_from_pdir_1): Move it there from here.
(try_thread_db_load_from_sdir): Update caller.
(try_thread_db_load_from_dir): Move it there from here.

10 years agoHave regdat.sh always rewrite the output register file
Patrick Palka [Fri, 10 Jan 2014 03:55:50 +0000 (22:55 -0500)] 
Have regdat.sh always rewrite the output register file

The rules for generating the output register files look like:

amd64.c : $(srcdir)/../regformats/i386/amd64.dat $(regdat_sh)
$(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64.dat amd64.c

According to this rule, if regdat.sh is newer than amd64.c, then
regdat.sh shall be invoked on amd64.dat.  According to regdat.sh, if the
script determines that the output file amd64.c has not changed, then it
will not overwrite the existing output file.  This means that a
subsequent invocation of make will trigger the above rule again as
regdat.sh will be perpetually newer than amd64.c.

This then shows up in the make output like so:

/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-linux.dat amd64-linux.c
amd64-linux.c unchanged.
/bin/bash ./../regformats/regdat.sh ./../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c
amd64-avx-linux.c unchanged.
...

To fix this pathological behavior, it suffices to have regdat.sh
unconditionally rewrite the output register file.

On my machine, which has a regdat.sh file that is newer than some of the
input register files, this change speeds up every invocation of make
under gdb/ by about 5 seconds.

10 years agoNew "make check-headers" rule.
Pedro Alves [Mon, 13 Jan 2014 19:36:38 +0000 (19:36 +0000)] 
New "make check-headers" rule.

Tries to compile each header in isolation, thus ensuring headers are
self-contained.

Defaults to checking all $HFILES_NO_SRCDIR headers.

Do:

  make check-headers CHECK_HEADERS="header.h list.h"

to check specific headers.

gdb/
2014-01-13  Pedro Alves  <palves@redhat.com>

        * Makefile.in (CHECK_HEADERS): New variable.
        (check-headers:): New rule.

10 years agoremove deprecated_set_hook
Tom Tromey [Sat, 28 Dec 2013 21:56:18 +0000 (14:56 -0700)] 
remove deprecated_set_hook

This removes deprecated_set_hook.  Insight was the last user of this
hook, but I recently checked in a patch to have it use the
command_param_changed observer instead.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* cli/cli-setshow.c (do_set_command): Update.
* defs.h (deprecated_set_hook): Remove.
* top.c (deprecated_set_hook): Remove.

10 years agoFix MinGW compilation errors in gdbserver/.
Eli Zaretskii [Mon, 13 Jan 2014 18:54:47 +0000 (20:54 +0200)] 
Fix MinGW compilation errors in gdbserver/.

gdb/gdbserver/Makefile.in (INCLUDE_CFLAGS): Remove trailing slash from
"-I$(srcdir)/../".  Fixes MinGW compilation errors with old GCC versions.

10 years ago2014-01-13 Ma Jiang <ma.jiang@zte.com.cn>
Ma Jiang [Mon, 13 Jan 2014 16:06:28 +0000 (16:06 +0000)] 
2014-01-13  Ma Jiang  <ma.jiang@zte.com.cn>

PR ld/16202
* elf32-arm.c (elf32_arm_final_link_relocate): Refetch addends for
R_ARM_ABS8 and R_ARM_ABS16.

10 years agotfile: Don't infer the PC from the tracepoint if the PC is a pseudo-register.
Pedro Alves [Mon, 13 Jan 2014 14:56:29 +0000 (14:56 +0000)] 
tfile: Don't infer the PC from the tracepoint if the PC is a pseudo-register.

This PC guessing can't work when the PC is a pseudo-register.
Pseudo-register values don't end up stored in the regcache, they're
always recomputed.  And, it's actually wrong to try to write a
pseudo-register with regcache_raw_supply.  Skip it and add a comment.

gdb/
2014-01-13  Pedro Alves  <palves@redhat.com>

* tracepoint.c (tfile_fetch_registers): Don't infer the PC from
the tracepoint if the PC is a pseudo-register.

10 years agoreplace XCALLOC with XCNEWVEC or XCNEW
Tom Tromey [Sat, 28 Dec 2013 22:32:27 +0000 (15:32 -0700)] 
replace XCALLOC with XCNEWVEC or XCNEW

This removes XCALLOC and replaces it either with XCNEWVEC, or, if the
number of elements being requested was 1, with XCNEW.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* defs.h (XCALLOC): Remove.
* bcache.c (bcache_xmalloc): Use XCNEW, not XCALLOC.
(print_bcache_statistics): Use XCNEWVEC, not XCALLOC.
* dwarf2loc.c (allocate_piece_closure): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
(elf_symfile_segments): Likewise.
* gdbtypes.c (copy_type_recursive): Likewise.
* i386-tdep.c (i386_gdbarch_init): Use XCNEW, not XCALLOC.
* jit.c (jit_frame_sniffer): Use XCNEWVEC, not XCALLOC.
* minsyms.c (prim_record_minimal_symbol_full): Use XCNEW, not
XCALLOC.
* mt-tdep.c (mt_gdbarch_init): Likewise.
* opencl-lang.c (allocate_lval_closure): Use XCNEWVEC, not
XCALLOC.
* psymtab.c (psymbol_compare): Use XCNEW, not XCALLOC.
* regcache.c (regcache_xmalloc_1): Use XCNEWVEC, not XCALLOC.
* registry.c (registry_alloc_data): Likewise.
* rs6000-tdep.c (rs6000_gdbarch_init): Use XCNEW, not XCALLOC.
* s390-linux-tdep.c (s390_gdbarch_init): Likewise.
* serial.c (serial_fdopen_ops): Likewise.
* solib-aix.c (solib_aix_get_section_offsets): Use XCNEWVEC, not
XCALLOC.
* spu-tdep.c (spu_gdbarch_init): Use XCNEW, not XCALLOC.
* symfile.c (default_symfile_segments): Use XCNEW and XCNEWVEC,
not XCALLOC.

10 years agoreplace XMALLOC with XNEW
Tom Tromey [Sat, 28 Dec 2013 22:31:23 +0000 (15:31 -0700)] 
replace XMALLOC with XNEW

This replaces XMALLOC with XNEW, and removes XMALLOC.  The only
non-mechanical bit here was remembering to edit gdbarch.sh.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* defs.h (XMALLOC): Remove.
* avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC.
* bfin-tdep.c (bfin_gdbarch_init): Likewise.
* cli-out.c (struct ui_out *): Likewise.
* cli/cli-dump.c (add_dump_command): Likewise.
(add_dump_command): Likewise.
* complaints.c (get_complaints): Likewise.
(find_complaint): Likewise.
* dwarf2-frame.c (execute_cfa_program): Likewise.
* dwarf2read.c (abbrev_table_read_table): Likewise.
* gdbarch.sh: Likewise.
* gdbarch.c: Rebuild.
* inf-ttrace.c (inf_ttrace_add_page): Likewise.
* interps.c (interp_new): Likewise.
* lm32-tdep.c (lm32_gdbarch_init): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* mi/mi-console.c (mi_console_file_new): Likewise.
* mi/mi-interp.c (mi_interpreter_init): Likewise.
* mi/mi-out.c (mi_out_new): Likewise.
* mi/mi-parse.c (mi_parse): Likewise.
* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* observer.c (xalloc_observer_list_node): Likewise.
* regcache.c (regcache_xmalloc_1): Likewise.
* reggroups.c (reggroup_new): Likewise.
(_initialize_reggroup): Likewise.
* registry.c (register_data_with_cleanup): Likewise.
* remote.c (remote_notif_stop_alloc_reply): Likewise.
* ser-base.c (serial_ttystate): Likewise.
* ser-mingw.c (make_pipe_state): Likewise.
* ser-pipe.c (pipe_open): Likewise.
* serial.c (serial_open): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-file.c (tui_file_new): Likewise.
* tui/tui-out.c (tui_out_new): Likewise.
* ui-file.c (mem_file_new): Likewise.
* ui-out.c (push_level): Likewise.
(make_cleanup_ui_out_end): Likewise.
(append_header_to_list): Likewise.
(ui_out_new): Likewise.
* user-regs.c (user_reg_add_builtin): Likewise.

10 years agoreplace XZALLOC with XCNEW
Tom Tromey [Sat, 28 Dec 2013 22:31:01 +0000 (15:31 -0700)] 
replace XZALLOC with XCNEW

This replaces XZALLOC with XCNEW and removes XZALLOC.
This change is purely mechanical.

2014-01-13  Tom Tromey  <tromey@redhat.com>

* defs.h (XZALLOC): Remove.
* ada-lang.c (get_ada_inferior_data): Use XCNEW, not XZALLOC.
* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
(get_ada_tasks_inferior_data): Likewise.
* auto-load.c (get_auto_load_pspace_data): Likewise.
* auxv.c (get_auxv_inferior_data): Likewise.
* bfd-target.c (target_bfd_reopen): Likewise.
* breakpoint.c (get_catch_syscall_inferior_data): Likewise.
(deprecated_insert_raw_breakpoint): Likewise.
* bsd-uthread.c (bsd_uthread_pid_to_str): Likewise.
* corelow.c (core_open): Likewise.
* darwin-nat.c (darwin_check_new_threads): Likewise.
(darwin_attach_pid): Likewise.
* dummy-frame.c (dummy_frame_push): Likewise.
* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
* dwarf2loc.c (allocate_piece_closure): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
* eval.c (ptrmath_type_p): Likewise.
* exceptions.c (EXCEPTIONS_SIGJMP_BUF): Likewise.
* gdbtypes.c (alloc_type_arch): Likewise.
(alloc_type_instance): Likewise.
* hppa-tdep.c (hppa_gdbarch_init): Likewise.
* inf-child.c (inf_child_can_use_agent): Likewise.
* inflow.c (get_inflow_inferior_data): Likewise.
* infrun.c (save_infcall_suspend_state): Likewise.
* jit.c (jit_reader_load): Likewise.
(get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_open_impl): Likewise.
(jit_symtab_open_impl): Likewise.
(jit_block_open_impl): Likewise.
(jit_frame_sniffer): Likewise.
* linux-fork.c (add_fork): Likewise.
* maint.c (make_command_stats_cleanup): Likewise.
* objfiles.c (get_objfile_pspace_data): Likewise.
* opencl-lang.c (struct lval_closure): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
* progspace.c (new_address_space): Likewise.
(add_program_space): Likewise.
* remote-sim.c (get_sim_inferior_data): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* skip.c (Ignore): Likewise.
(skip_delete_command): Likewise.
* solib-aix.c (get_solib_aix_inferior_data): Likewise.
(library_list_start_library): Likewise.
(solib_aix_current_sos): Likewise.
* solib-darwin.c (get_darwin_info): Likewise.
(darwin_current_sos): Likewise.
* solib-dsbt.c (get_dsbt_info): Likewise.
* solib-ia64-hpux.c (new_so_list): Likewise.
(ia64_hpux_get_solib_linkage_addr): Likewise.
* solib-spu.c (append_ocl_sos): Likewise.
(spu_current_sos): Likewise.
* solib-svr4.c (get_svr4_info): Likewise.
(svr4_keep_data_in_core): Likewise.
(library_list_start_library): Likewise.
(svr4_default_sos): Likewise.
(svr4_read_so_list): Likewise.
* solib-target.c (library_list_start_library): Likewise.
(solib_target_current_sos): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* symfile-debug.c (install_symfile_debug_logging): Likewise.
* symfile.c (default_symfile_segments): Likewise.
* target-descriptions.c (tdesc_data_init): Likewise.
(tdesc_create_reg): Likewise.
(struct tdesc_type *): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_set_struct_size): Likewise.
(struct tdesc_type *): Likewise.
(tdesc_free_feature): Likewise.
(tdesc_create_feature): Likewise.
* windows-nat.c (windows_add_thread): Likewise.
(windows_make_so): Likewise.
* xml-support.c (gdb_xml_body_text): Likewise.
(gdb_xml_create_parser_and_cleanup): Likewise.
(xml_process_xincludes): Likewise.
* xml-syscall.c (allocate_syscalls_info): Likewise.
(syscall_create_syscall_desc): Likewise.

10 years agomissing changelog for last patch
Alan Modra [Mon, 13 Jan 2014 05:18:24 +0000 (15:48 +1030)] 
missing changelog for last patch

10 years agoError on shared lib call to @local ifunc
Alan Modra [Mon, 13 Jan 2014 03:21:16 +0000 (13:51 +1030)] 
Error on shared lib call to @local ifunc

On powerpc32, making ifuncs have non-default visibility in shared
libraries or pies can result in runtime failures.  The problem is that
if gcc is told that a given function has non-default visibility, then
calls to that function are assumed to be local (which is true) and
thus need not go via a plt call stub (which is false for ifunc).  If
the caller has no other reason to set up the got pointer (r30), code
won't be emitted to do so.  However, a pic plt call stub makes use of
r30 to load the plt entry.  So a call to an ifunc, which always needs
a plt entry, will fail.

This patch makes ld emit an error for the problem case, and allows
calls to non-default visibility ifuncs to work in normal executables.
I also fix some cases where ifuncs fail when using the old bss-plt.

* elf32-ppc.c (ppc_elf_check_relocs): For @local call to ifunc,
error when shared and force a plt call otherwise.
(ppc_elf_size_dynamic_sections): Don't emit DT_PPC_GOT unless
plt_type == PLT_NEW.
(ppc_elf_relocate_section): Add missing test to resolve ifuncs to
the appropriate call stub.

10 years agodaily update
Alan Modra [Sun, 12 Jan 2014 23:00:37 +0000 (09:30 +1030)] 
daily update

10 years agoSplit i386_stap_parse_special_token into smaller functions
Sergio Durigan Junior [Sun, 12 Jan 2014 03:32:26 +0000 (01:32 -0200)] 
Split i386_stap_parse_special_token into smaller functions

This patch reorganizes code on gdb/i386-tdep.c's SystemTap SDT probe
support functions.  Before it, the code to parse special operands on x86
lived in a single, big function.  This patch creates 2 new functions
that makes the code more organized and removes a few indentation levels
(which is always good IMO).

I haven't modified anything logical in the functions, i.e., there's still
one latent bug on i386_stap_parse_special_token_triplet now.  I will soon
post a patch to fix this, and to also improve the readability of the two
new functions.

2014-01-12  Sergio Durigan Junior  <sergiodj@redhat.com>

* i386-tdep.c (i386_stap_parse_special_token_triplet): New
function, with code from i386_stap_parse_special_token.
(i386_stap_parse_special_token_three_arg_disp): Likewise.
(i386_stap_parse_special_token): Move code to the two functions
above; simplify it.

10 years agodaily update
Alan Modra [Sat, 11 Jan 2014 23:00:39 +0000 (09:30 +1030)] 
daily update

10 years agodaily update
Alan Modra [Fri, 10 Jan 2014 23:00:57 +0000 (09:30 +1030)] 
daily update

10 years ago[doc] Mention that "set environment" affects the shell too.
Pedro Alves [Fri, 10 Jan 2014 15:46:59 +0000 (15:46 +0000)] 
[doc] Mention that "set environment" affects the shell too.

gdb/doc/
2014-01-10  Pedro Alves  <palves@redhat.com>

* gdb.texinfo (Your Program's Environment) <set environment>:
Mention the shell, and point at 'set exec-wrapper'.

10 years agoSince upstream gcc has recently increased the function alignment on
Andreas Arnez [Fri, 10 Jan 2014 15:37:36 +0000 (15:37 +0000)] 
Since upstream gcc has recently increased the function alignment on
S390, the dw2-dir-file-name test case fails in the first
gdb_continue_to_breakpoint.  Indeed, the breakpoint is now placed into
the alignment gap *before* the actual function.

This happens because the test case declares the respective "*_start"
symbol as a "loose" label before the function definition, and the
compiler inserts the alignment between that label and the function
itself.

The "*_start" symbols were only necessary because FUNC made the
function static.  The fix makes the functions extern instead, thus
making the "*_start" labels unnecessary.

testsuite/
2014-01-10  Andreas Arnez  <arnez@linux.vnet.ibm.com>
    Pedro Alves <palves@redhat.com>

* gdb.dwarf2/dw2-dir-file-name.c (FUNC): Remove "*_start" symbol.
Make "name" extern.
* gdb.dwarf2/dw2-dir-file-name.exp (out_cu, out_line): Replace
references to ${name}_start by references to ${name}.

10 years agoDon't adjust LOAD segment to match GNU_RELRO segment
Alan Modra [Fri, 10 Jan 2014 10:41:46 +0000 (21:11 +1030)] 
Don't adjust LOAD segment to match GNU_RELRO segment

Instead, fix Jakub's original code setting up the PR_GNU_RELRO header
from the PT_LOAD header.

PR ld/14207
PR ld/16322
PR binutils/16323
bfd/
* elf.c (assign_file_positions_for_load_sections): Revert last change.
(assign_file_positions_for_non_load_sections): When setting up
PT_GNU_RELRO header, don't require a corresponding PT_LOAD
header that completely covers the relro region.
ld/
* ldlang.c (lang_size_sections): Remove unneeded RELRO base
adjust.  Tidy comments.
* ld.texinfo (DATA_SEGMENT_RELRO_END): Correct description.
ld/testsuite/
* ld-x86-64/pr14207.d: Adjust

10 years agoRemove path from gdb.ada/pp-rec-component.exp "source" test
Joel Brobecker [Fri, 10 Jan 2014 03:54:23 +0000 (07:54 +0400)] 
Remove path from gdb.ada/pp-rec-component.exp "source" test

gdb/testsuite/ChangeLog:

* gdb.ada/pp-rec-component.exp: Remove path from "source" test.

10 years agoRemove path from gdb.python/py-pp-integral.exp "source" test.
Joel Brobecker [Fri, 10 Jan 2014 03:50:29 +0000 (07:50 +0400)] 
Remove path from gdb.python/py-pp-integral.exp "source" test.

gdb/testsuite/ChangeLog:

* gdb.python/py-pp-integral.exp: Remove path from "source" test.

10 years ago * emulparams/crislinux.sh (COMMONPAGESIZE): Define.
Hans-Peter Nilsson [Fri, 10 Jan 2014 00:25:26 +0000 (01:25 +0100)] 
* emulparams/crislinux.sh (COMMONPAGESIZE): Define.

10 years agodaily update
Alan Modra [Thu, 9 Jan 2014 23:00:39 +0000 (09:30 +1030)] 
daily update

10 years agogdb.mi/mi-info-os.exp: Fix cross-debugger testing
Pedro Alves [Thu, 9 Jan 2014 19:57:13 +0000 (19:57 +0000)] 
gdb.mi/mi-info-os.exp: Fix cross-debugger testing

A live target is required for `-info-os' to work in non-native
configurations.

 (gdb)
 Expecting: ^(-info-os[
 ]+)?(.*\^done,OSDataTable=.*[
 ]+[(]gdb[)]
 [ ]*)
 -info-os
 ^error,msg="Don't know how to get OS data.  Try \"help target\"."
 (gdb)
 FAIL: gdb.mi/mi-info-os.exp: -info-os

If GDB does have a native configuration included, but we're testing
remote, it'll be worse, as if we're not connected yet, -info-os will
run against the default run target, and pass, falsely giving the
impression the remote bits were exercised.

gdb/testsuite/
2014-01-09  Maciej W. Rozycki  <macro@codesourcery.com>
    Pedro Alves  <palves@redhat.com>

* gdb.mi/mi-info-os.exp: Connect to the target with
        mi_gdb_target_load.

10 years agoFix buffer underrun in i386-dis.c.
Roland McGrath [Thu, 9 Jan 2014 18:13:10 +0000 (10:13 -0800)] 
Fix buffer underrun in i386-dis.c.

opcodes/
* i386-dis.c (print_insn): Do not touch all_prefixes[-1] when
last_rex_prefix is -1.

10 years agoHandle the case of a remote target supporting target side commands, but not on softwa...
Pedro Alves [Thu, 9 Jan 2014 18:33:45 +0000 (18:33 +0000)] 
Handle the case of a remote target supporting target side commands, but not on software breakpoints.

Although we can tell upfront whether a remote target supports target
side commands, we can only tell whether the target supports that in
combination with a given breakpoint kind (software, hardware,
watchpoints, etc.) when we go and try to insert such a breakpoint kind
the first time.  It's not desirable to make remote_insert_breakpoint
simply return -1 in this case, because if the breakpoint was set in a
shared library, insert_bp_location will assume that the breakpoint
insertion failed because the library wasn't mapped in.

insert_bp_location already handles errors/exceptions thrown from the
target_insert_xxx methods, exactly so the backend can tell the user
the detailed reason the insertion of hw breakpoints failed.  But, in
the case of software breakpoints, it discards the detailed error
message.

So the patch makes insert_bp_location use the error's message for SW
breakpoints too, and, introduces a NOT_SUPPORTED_ERROR error code so
that insert_bp_location doesn't confuse the error for failure due to a
shared library disappearing.

The result is:

(gdb) c
Warning:
Cannot insert breakpoint 2: Target doesn't support breakpoints that have target side commands.

2014-01-09  Pedro Alves  <palves@redhat.com>
    Hui Zhu  <hui@codesourcery.com>

PR gdb/16101
* breakpoint.c (insert_bp_location): Rename hw_bp_err_string to
bp_err_string.  Don't mark the location shlib_disabled if the
error thrown wasn't a generic or memory error.  Catch errors
thrown while inserting breakpoints in overlayed code.  Output
error message of software breakpoints.
* remote.c (remote_insert_breakpoint): If this breakpoint has
target-side commands but this stub doesn't support Z0 packets,
throw NOT_SUPPORTED_ERROR error.
* exceptions.h (enum errors) <NOT_SUPPORTED_ERROR>: New error.
* target.h (target_insert_breakpoint): Extend comment.
(target_insert_hw_breakpoint): Add comment.

10 years agoFix copyright year
H.J. Lu [Thu, 9 Jan 2014 18:23:03 +0000 (10:23 -0800)] 
Fix copyright year

10 years agoCheck if GNU_RELRO segment is is generated
H.J. Lu [Thu, 9 Jan 2014 18:18:19 +0000 (10:18 -0800)] 
Check if GNU_RELRO segment is is generated

Fail if GNU_RELRO segment isn't generated, but should.

* ld-elf/binutils.exp (binutils_test): Check if GNU_RELRO segment
is generated.

10 years agoremove include/gdbm.h
Tom Tromey [Thu, 9 Jan 2014 17:16:18 +0000 (10:16 -0700)] 
remove include/gdbm.h

include/gdbm.h is a relic.

2014-01-09  Tom Tromey  <tromey@redhat.com>

* gdbm.h: Remove.

10 years agoAdd and use check_lto_shared_available
H.J. Lu [Thu, 9 Jan 2014 17:01:53 +0000 (09:01 -0800)] 
Add and use check_lto_shared_available

2014-01-09  Vidya Praveen  <vidyapraveen@arm.com>

* lib/ld-lib.exp (check_lto_shared_available): New check.
* ld-plugin/lto.exp: Use check_lto_shared_available.

10 years agoUse table jump macros in coff-rs6000 targets.
Tristan Gingold [Fri, 6 Dec 2013 16:00:02 +0000 (17:00 +0100)] 
Use table jump macros in coff-rs6000 targets.

bfd/
2014-01-09  Tristan Gingold  <gingold@adacore.com>

* coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): use jump
table macros and add macros to initializa the structure.

10 years agodaily update
Alan Modra [Wed, 8 Jan 2014 23:00:37 +0000 (09:30 +1030)] 
daily update

10 years agoGDBserver: Discard previous queued events when GDB disconnects.
Pedro Alves [Wed, 8 Jan 2014 19:16:54 +0000 (19:16 +0000)] 
GDBserver: Discard previous queued events when GDB disconnects.

... not when a new GDB connection sends the status packet ('?').
Mainly just a cleanup/simplification, as GDB always sends '?' first.

Tested on x86_64 Fedora 17.

2014-01-08  Pedro Alves  <palves@redhat.com>

* server.c (handle_status): Don't discard previous queued stop
replies or thread's pending status here.
(main) <disconnection>: Do it here instead.

10 years ago[remote/gdbserver] Don't lose signals when reconnecting.
Pedro Alves [Wed, 8 Jan 2014 18:55:51 +0000 (18:55 +0000)] 
[remote/gdbserver] Don't lose signals when reconnecting.

Currently, when GDB connects in all-stop mode, GDBserver always
responds to the status packet with a GDB_SIGNAL_TRAP, even if the
program is actually stopped for some other signal.

 (gdb) tar rem ...
 ...
 (gdb) c
 Program received signal SIGUSR1, User defined signal 1.
 (gdb) disconnect
 (gdb) tar rem ...
 (gdb) c

(Or a GDB crash instead of an explicit disconnect.)

This results in the program losing that signal on that last continue,
because gdb will tell the target to resume with no signal (to suppress
the GDB_SIGNAL_TRAP, due to 'handle SISGTRAP nopass'), and that will
actually suppress the real signal the program had stopped for
(SIGUSR1).  To fix that, I think we should make GDBserver report the
real signal the thread had stopped for in response to the status
packet:

 @item ?
 @cindex @samp{?} packet
 Indicate the reason the target halted.  The reply is the same as for
 step and continue.

But, that raises the question -- which thread are we reporting the
status for?  Due to how the RSP in all-stop works, we can only report
one status.  The status packet's response is a stop reply packet, so
it includes the thread identifier, so it's not a problem packet-wise.
However, GDBserver is currently always reporting the status for first
thread in the thread list, even though that may well not be the thread
that got the signal that caused the program to stop.  So the next
logical step would be to report the status for the
last_ptid/last_status thread (the last event reported to gdb), if it's
still around; and if not, fallback to some other thread.

There's an issue on the GDB side with that, though...

GDB currently always adds the thread reported in response to the
status query as the first thread in its list.  That means that if we
start with e.g.,

 (gdb) info threads
   3 Thread 1003 ...
 * 2 Thread 1002 ...
   1 Thread 1001 ...

And reconnect:

 (gdb) disconnect
 (gdb) tar rem ...

We end up with:

 (gdb) info threads
   3 Thread 1003 ...
   2 Thread 1001 ...
 * 1 Thread 1002 ...

Not a real big issue, but it's reasonably fixable, by having GDB
fetch/sync the thread list before fetching the status/'?', and then
using the status to select the right thread as current on the GDB
side.  Holes in the thread numbers are squashed before/after
reconnection (e.g., 2,3,5 becomes 1,2,3), but the order is preserved,
which I think is both good, and good enough.

However (yes, there's more...), the previous GDB that was connected
might have had gdbserver running in non-stop mode, or could have left
gdbserver doing disconnected tracing (which also forces non-stop), and
if the new gdb/connection is in all-stop mode, we can end up with more
than one thread with a signal to report back to gdb.  As we can only
report one thread/status (in the all-stop RSP variant; the non-stop
variant doesn't have this issue), we get to do what we do at every
other place we have this situation -- leave events we can't report
right now as pending, so that the next resume picks them up.

Note all this ammounts to a QoI change, within the existing framework.
There's really no RSP change here.

The only user visible change (other than that the signal is program is
stopped at isn't lost / is passed to the program), is in "info
program", that now can show the signal the program stopped for.  Of
course, the next resume will respect the pass/nopass setting for the
signal in question.  It'd be reasonable to have the initial connection
tell the user the program was stopped with a signal, similar to when
we load a core to debug, but I'm leaving that out for a future change.
I think we'll need to either change how handle_inferior_event & co
handle stop_soon, or maybe bypass them completely (like
fork-child.c:startup_inferior) for that.

Tested on x86_64 Fedora 17.

gdb/gdbserver/
2014-01-08  Pedro Alves  <palves@redhat.com>

* gdbthread.h (struct thread_info) <status_pending_p>: New field.
* server.c (visit_actioned_threads, handle_pending_status): New
function.
(handle_v_cont): Factor out parts to ...
(resume): ... this new function.  If in all-stop, and a thread
being resumed has a pending status, report it without actually
resuming.
(myresume): Adjust to use the new 'resume' function.
(clear_pending_status_callback, set_pending_status_callback)
(find_status_pending_thread_callback): New functions.
(handle_status): Handle the case of multiple threads having
interesting statuses to report.  Report threads' real last signal
instead of always reporting GDB_SIGNAL_TRAP.  Look for a thread
with an interesting thread to report the status for, instead of
always reporting the status of the first thread.

gdb/
2014-01-08  Pedro Alves  <palves@redhat.com>

* remote.c (remote_add_thread): Add threads silently if starting
up.
(remote_notice_new_inferior): If in all-stop, and starting up,
don't call notice_new_inferior.
(get_current_thread): New function, factored out from ...
(add_current_inferior_and_thread): ... this.  Adjust.
(remote_start_remote) <all-stop>: Fetch the thread list.  If we
found any thread, then select the remote's current thread as GDB's
current thread too.

gdb/testsuite/
2014-01-08  Pedro Alves  <palves@redhat.com>

* gdb.threads/reconnect-signal.c: New file.
* gdb.threads/reconnect-signal.exp: New file.

10 years agoRemove regbnd and vec_disp8
H.J. Lu [Wed, 8 Jan 2014 16:22:35 +0000 (08:22 -0800)] 
Remove regbnd and vec_disp8

* config/tc-i386.c (regbnd): Removed.
(vec_disp8): Likewise.

10 years agoAdjust LOAD segment to generate GNU_RELRO segment
H.J. Lu [Thu, 12 Dec 2013 18:35:47 +0000 (10:35 -0800)] 
Adjust LOAD segment to generate GNU_RELRO segment

This patch fixes 2 GNU_RELRO segment bugs:

1. lang_size_sections didn't properly align base to the maximum
alignment power of sections between DATA_SEGMENT_ALIGN and
DATA_SEGMENT_RELRO_END.
2. ld failed to adjust LOAD segment to generate GNU_RELRO segment
when LOAD segment doesn't fit GNU_RELRO segment.  This is

https://sourceware.org/bugzilla/show_bug.cgi?id=14207

We "fixed" ld by not generating GNU_RELRO segment.  This patch
adjusts LOAD segment to generate GNU_RELRO segment.  It fixes
PR ld/16322 and at the same time it also fixes PR binutils/16323
since now we can adjust LOAD segment if it is too small.

bfd/

PR ld/14207
PR ld/16322
PR binutils/16323
* elf.c (_bfd_elf_map_sections_to_segments): Don't check section
size for PT_GNU_RELRO segment.
(assign_file_positions_for_load_sections): If PT_LOAD segment
doesn't fit PT_GNU_RELRO segment, adjust its p_filesz and p_memsz.

ld/

PR ld/14207
PR ld/16322
PR binutils/16323
* ldlang.c (lang_size_sections): Properly align RELRO base.

ld/testsuite/

PR ld/14207
PR ld/16322
PR binutils/16323
* ld-elf/pr16322.d: New file.
* ld-elf/pr16322.s: Likewise.

* ld-x86-64/pr14207.d: Expect PT_GNU_RELRO segment.

10 years agoUpdate copyright year to 2014
H.J. Lu [Wed, 8 Jan 2014 13:48:12 +0000 (05:48 -0800)] 
Update copyright year to 2014

binutils/

* version.c (print_version): Update copyright year to 2014.

gas/

* as.c (parse_args): Update copyright year to 2014.

gold/

* version.cc (print_version): Update copyright year to 2014.

ld/

* ldver.c (ldversion): Update copyright year to 2014.

opcodes/

* i386-gen.c (process_copyright): Update copyright year to 2014.

10 years agoNew Year - binutils ChangeLog rotation
H.J. Lu [Wed, 8 Jan 2014 13:32:12 +0000 (05:32 -0800)] 
New Year - binutils ChangeLog rotation

10 years agoUpdate NEWS post GDB 7.7 branch creation.
Joel Brobecker [Wed, 8 Jan 2014 09:41:03 +0000 (13:41 +0400)] 
Update NEWS post GDB 7.7 branch creation.

gdb/ChangeLog:

* NEWS: Create a new section for the next release branch.
Rename the section of the current branch, now that it has
been cut.

10 years agoBump version to 7.7.50.DATE-cvs.
Joel Brobecker [Wed, 8 Jan 2014 09:25:28 +0000 (13:25 +0400)] 
Bump version to 7.7.50.DATE-cvs.

Now that the GDB 7.7 branch has been created, we can
bump the version number.

gdb/ChangeLog:

GDB 7.7 branch created (79301218fa0f074c5656db0ec8972a5ddcf91fb5):
* version.in: Bump version to 7.7.50.DATE-cvs.

10 years agoAdd missing ChangeLog entries.
Joel Brobecker [Wed, 8 Jan 2014 09:16:32 +0000 (13:16 +0400)] 
Add missing ChangeLog entries.

10 years agoFix pointer assignment with different signedness
Yao Qi [Tue, 7 Jan 2014 10:12:21 +0000 (18:12 +0800)] 
Fix pointer assignment with different signedness

This patch fixes these errors below:

../../binutils-gdb/gdb/spu-linux-nat.c: In function ‘spu_symbol_file_add_from_memory’:
../../binutils-gdb/gdb/spu-linux-nat.c:368:3: error: pointer targets in passing argument 2 of ‘spu_proc_xfer_spu’ differ in signedness [-Werror=pointer-sign]
../../binutils-gdb/gdb/spu-linux-nat.c:232:1: note: expected ‘gdb_byte *’ but argument is of type ‘char *’
../../binutils-gdb/gdb/spu-linux-nat.c: In function ‘spu_xfer_partial’:
../../binutils-gdb/gdb/spu-linux-nat.c:598:7: error: pointer targets in passing argument 1 of ‘strtoulst’ differ in signedness [-Werror=pointer-sign]
In file included from ../../binutils-gdb/gdb/defs.h:769:0,
                 from ../../binutils-gdb/gdb/spu-linux-nat.c:21:
../../binutils-gdb/gdb/utils.h:43:15: note: expected ‘const char *’ but argument is of type ‘gdb_byte *’

gdb:

2014-01-08  Yao Qi  <yao@codesourcery.com>

* spu-linux-nat.c (spu_symbol_file_add_from_memory): Change
type of 'id' to gdb_byte.  Cast 'id' to 'const char *'.
(spu_xfer_partial): Cast 'buf' to 'const char *'.

10 years agoPass name to symbol_file_add_from_bfd
Yao Qi [Tue, 7 Jan 2014 09:48:07 +0000 (17:48 +0800)] 
Pass name to symbol_file_add_from_bfd

This patch fixes the following build error:

../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 2 of ‘symbol_file_add_from_bfd’ makes pointer from integer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected ‘const char *’ but argument is of type ‘int’
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 3 of ‘symbol_file_add_from_bfd’ makes integer from pointer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected ‘int’ but argument is of type ‘void *’
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: passing argument 5 of ‘symbol_file_add_from_bfd’ makes integer from pointer without a cast [-Werror]
In file included from ../../binutils-gdb/gdb/spu-linux-nat.c:29:0:
../../binutils-gdb/gdb/symfile.h:444:24: note: expected ‘int’ but argument is of type ‘void *’
../../binutils-gdb/gdb/spu-linux-nat.c:383:5: error: too few arguments to function ‘symbol_file_add_from_bfd’

Argument 'name' was added to function symbol_file_add_from_bfd by this patch

  [patchv4 4/5] Keep objfile original filename
  https://sourceware.org/ml/gdb-patches/2013-09/msg00683.html

but caller of symbol_file_add_from_bfd in spu-linux-nat.c wasn't updated.

This patch fixes the build error.

gdb:

2014-01-08  Yao Qi  <yao@codesourcery.com>

* spu-linux-nat.c (spu_symbol_file_add_from_memory): Pass
return value of bfd_get_filename to symbol_file_add_from_bfd.

10 years ago Fix PR16201.
Pierre Muller [Tue, 7 Jan 2014 23:31:50 +0000 (00:31 +0100)] 
Fix PR16201.
* coff-pe-read.c (struct read_pe_section_data): Add index field.
(add_pe_exported_sym): Use SECTION_DATA->INDEX for call
to prim_record_mininal_symbol_and_info.
(add_pe_forwarded_sym): Use known section number of forwarded symbol
in call to prim_record_minimal_symbol_and_info.
(read_pe_exported_syms): Set index field of section_data.

10 years agodaily update
Alan Modra [Tue, 7 Jan 2014 23:00:55 +0000 (09:30 +1030)] 
daily update

10 years agoAARCH64: Change cpsr type to be 64bit.
Andrew Pinski [Wed, 18 Dec 2013 19:03:07 +0000 (11:03 -0800)] 
AARCH64: Change cpsr type to be 64bit.

2013-12-18  Andrew Pinski  <apinski@cavium.com>

* features/aarch64-core.xml (cpsr): Change to be 64bit.
* features/aarch64.c: Regenerate.

10 years agoUse correct default for target functions that return pointer
Andreas Schwab [Tue, 7 Jan 2014 20:28:53 +0000 (21:28 +0100)] 
Use correct default for target functions that return pointer

* target.c (return_null): Define.
(update_current_target): Use it instead of return_zero for
functions that return a pointer.

10 years agoFix dir command for duplicated paths and add a new testcase.
Edjunior Barbosa Machado [Tue, 7 Jan 2014 19:03:06 +0000 (17:03 -0200)] 
Fix dir command for duplicated paths and add a new testcase.

gdb/ChangeLog:
2014-01-07  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* source.c (add_path): Fix check for duplicated paths in the previously
included paths.

gdb/testsuite/ChangeLog:
2014-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.base/source-dir.exp: New file.

10 years agoremove VA_* macros from sim
Tom Tromey [Sun, 5 Jan 2014 04:46:15 +0000 (21:46 -0700)] 
remove VA_* macros from sim

Remove the obsolete VA_* macros from sim.

2014-01-06  Tom Tromey  <tromey@redhat.com>

* common/cgen-trace.c: Don't use old VA_* macros.
* common/sim-load.c (xprintf): Likewise.
* common/sim-trace.c (trace_printf, debug_printf): Likewise.

10 years agoremove PARAMS from sim
Tom Tromey [Sun, 5 Jan 2014 04:43:21 +0000 (21:43 -0700)] 
remove PARAMS from sim

This removes the last uses of PARAMS from sim.

2014-01-06  Tom Tromey  <tromey@redhat.com>

* README-HACKING: Don't use PARAMS.
* arm/wrapper.c: Don't use PARAMS.
* bfin/sim-main.h: Don't use PARAMS.
* common/callback.c: Don't use PARAMS.
* common/cgen-trace.c: Don't use PARAMS.
* common/run-sim.h: Don't use PARAMS.
* common/run.c: Don't use PARAMS.
* common/sim-base.h: Don't use PARAMS.
* common/sim-load.c: Don't use PARAMS.
* common/sim-options.h: Don't use PARAMS.
* common/sim-trace.c: Don't use PARAMS.
* common/sim-trace.h: Don't use PARAMS.
* common/sim-utils.h: Don't use PARAMS.
* cr16/cr16_sim.h: Don't use PARAMS.
* cr16/gencode.c: Don't use PARAMS.
* cr16/interp.c: Don't use PARAMS.
* cr16/simops.c: Don't use PARAMS.
* d10v/d10v_sim.h: Don't use PARAMS.
* d10v/gencode.c: Don't use PARAMS.
* d10v/interp.c: Don't use PARAMS.
* d10v/simops.c: Don't use PARAMS.
* erc32/erc32.c: Don't use PARAMS.
* erc32/exec.c: Don't use PARAMS.
* erc32/float.c: Don't use PARAMS.
* erc32/func.c: Don't use PARAMS.
* erc32/sis.c: Don't use PARAMS.
* erc32/sis.h: Don't use PARAMS.
* mips/interp.c: Don't use PARAMS.
* mips/sim-main.h: Don't use PARAMS.
* sh/interp.c: Don't use PARAMS.
* v850/sim-main.h: Don't use PARAMS.
* v850/v850_sim.h: Don't use PARAMS.

10 years agoremove PARAMS from include/cgen
Tom Tromey [Mon, 6 Jan 2014 02:41:32 +0000 (19:41 -0700)] 
remove PARAMS from include/cgen

This removes the remaining uses of PARAMS from include/cgen.
Tested by rebuilding; a file in opcodes includes this header.

2014-01-06  Tom Tromey  <tromey@redhat.com>

* bitset.h: Remove uses of PARAMS.

10 years agoremove VA_* from binutils
Tom Tromey [Sun, 5 Jan 2014 04:47:10 +0000 (21:47 -0700)] 
remove VA_* from binutils

This removes the last uses of the obsolete VA_* macros from binutils.

All the binutils and bfd changes were tested by rebuilding.
I didn't rebuild the gas change but I think it is obviously correct.

2014-01-07  Tom Tromey  <tromey@redhat.com>

* elf32-xtensa.c (vsprint_msg): Don't use old VA_* compatibility
wrappers.

2014-01-07  Tom Tromey  <tromey@redhat.com>

* bucomm.c (fatal, non_fatal): Replace obsolete VA_* macros with
stdarg macros.
* dlltool.c (inform): Replace obsolete VA_* macros with stdarg
macros.
* dllwrap.c (inform, warn): Replace obsolete VA_* macros with
stdarg macros.

2014-01-07  Tom Tromey  <tromey@redhat.com>

* config/tc-tic30.c (debug): Avoid old VA_* compatibility
wrappers.

10 years agoremove uses of PARAMS from binutils
Tom Tromey [Mon, 6 Jan 2014 02:49:29 +0000 (19:49 -0700)] 
remove uses of PARAMS from binutils

This removes the last uses of PARAMS from binutils.

The two changes in binutils were tested by rebuilding.
I didn't rebuild the gas change but I think it is obviously correct.

2014-01-07  Tom Tromey  <tromey@redhat.com>

* coffgrok.h (coff_ofile): Don't use PARAMS.
* nlmheader.y (strerror): Don't use PARAMS.

2014-01-07  Tom Tromey  <tromey@redhat.com>

* config/tc-microblaze.h (parse_cons_expression_microblaze): Don't
use PARAMS.

10 years agoremove ANSI_PROTOTYPES
Tom Tromey [Mon, 23 Dec 2013 17:11:10 +0000 (10:11 -0700)] 
remove ANSI_PROTOTYPES

This removes the last use of ANSI_PROTOTYPES in the tree.
It appears in gas.

I didn't even rebuild this but I think it is obviously correct.

2014-01-07  Tom Tromey  <tromey@redhat.com>

* config/tc-xc16x.h: Don't use ANSI_PROTOTYPES.

10 years agoRemove duplicated #include's from GDB
Honggyu Kim [Tue, 7 Jan 2014 03:25:10 +0000 (01:25 -0200)] 
Remove duplicated #include's from GDB

This patch simply removes duplicated #include statements in the gdb/
directory.  If there are two duplicated #include statements, this patch
keeps the first #include and removes the second.

Those duplicates have been found by using the checkincludes.pl tool from
the Linux kernel and double checked manually once again if the #include
statements are affected by #ifdef macros.

2014-01-06  Honggyu Kim  <hong.gyu.kim@lge.com>

* ada-lang.c: Remove duplicated include statements.
* alphabsd-nat.c: Ditto.
* amd64-darwin-tdep.c: Ditto.
* amd64fbsd-nat.c: Ditto.
* auto-load.c: Ditto.
* ax-gdb.c: Ditto.
* breakpoint.c: Ditto.
* dbxread.c: Ditto.
* fork-child.c: Ditto.
* gdb_usleep.c: Ditto.
* i386-darwin-tdep.c: Ditto.
* i386fbsd-nat.c: Ditto.
* infcmd.c: Ditto.
* inferior.c: Ditto.
* jv-lang.c: Ditto.
* linux-nat.c: Ditto.
* linux-tdep.c: Ditto.
* m68kbsd-nat.c: Ditto.
* m68klinux-nat.c: Ditto.
* microblaze-tdep.c: Ditto.
* mips-linux-tdep.c: Ditto.
* mn10300-tdep.c: Ditto.
* nto-tdep.c: Ditto.
* opencl-lang.c: Ditto.
* osdata.c: Ditto.
* printcmd.c: Ditto.
* regcache.c: Ditto.
* remote-m32r-sdi.c: Ditto.
* remote.c: Ditto.
* symfile.c: Ditto.
* symtab.c: Ditto.
* tilegx-linux-nat.c: Ditto.
* tilegx-tdep.c: Ditto.
* tracepoint.c: Ditto.
* valops.c: Ditto.
* vaxbsd-nat.c: Ditto.
* windows-nat.c: Ditto.
* xtensa-tdep.c: Ditto.

10 years agoFix missing-prototypes error for '_initialize_spu_nat'
Yao Qi [Tue, 7 Jan 2014 09:28:48 +0000 (17:28 +0800)] 
Fix missing-prototypes error for '_initialize_spu_nat'

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.

10 years ago[AArch64] Add GAS recognition for "xgene-1"
Philipp Tomsich [Wed, 4 Dec 2013 18:29:25 +0000 (19:29 +0100)] 
[AArch64] Add GAS recognition for "xgene-1"

* config/tc-aarch64.c (aarch64_cpus): Add entry for "xgene-1"

This adds support for the AppliedMicro X-Gene 1 processor to the
assembler.

10 years agoCast to uintptr_t when calling ptrace32 on aix
Yao Qi [Sat, 4 Jan 2014 07:48:21 +0000 (15:48 +0800)] 
Cast to uintptr_t when calling ptrace32 on aix

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.

10 years agovarobj/Ada: Missing children for interface-wide tagged types
Joel Brobecker [Sat, 4 Jan 2014 02:31:11 +0000 (06:31 +0400)] 
varobj/Ada: Missing children for interface-wide tagged types

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.

10 years agoAda: Fix missing call to pretty-printer for fields of records.
Joel Brobecker [Thu, 19 Dec 2013 17:26:55 +0000 (21:26 +0400)] 
Ada: Fix missing call to pretty-printer for fields of records.

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.

10 years agoada_print_floating: Remove use of statically sized buffer.
Joel Brobecker [Thu, 19 Dec 2013 16:19:45 +0000 (20:19 +0400)] 
ada_print_floating: Remove use of statically sized buffer.

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.

10 years agoExtract string-printing out of ada_val_print_array
Joel Brobecker [Thu, 19 Dec 2013 16:06:46 +0000 (20:06 +0400)] 
Extract string-printing out of ada_val_print_array

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.

10 years agomove ada_val_print_array down within other ada_val_print* functions
Joel Brobecker [Thu, 19 Dec 2013 15:43:57 +0000 (19:43 +0400)] 
move ada_val_print_array down within other ada_val_print* functions

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".

10 years agorewrite ada_val_print_ref to reduce if/else block nesting depth
Joel Brobecker [Thu, 19 Dec 2013 15:26:27 +0000 (19:26 +0400)] 
rewrite ada_val_print_ref to reduce if/else block nesting depth

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>".

10 years agoada-valprint.c: Inline print_record inside ada_val_print_struct_union
Joel Brobecker [Thu, 19 Dec 2013 15:11:49 +0000 (19:11 +0400)] 
ada-valprint.c: Inline print_record inside ada_val_print_struct_union

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.

10 years agoSplit ada_val_print_1 into smaller functions
Joel Brobecker [Thu, 19 Dec 2013 12:30:43 +0000 (16:30 +0400)] 
Split ada_val_print_1 into smaller functions

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.

10 years agoRemove call to gdb_flush at end of ada_val_print_1
Joel Brobecker [Thu, 19 Dec 2013 11:48:39 +0000 (15:48 +0400)] 
Remove call to gdb_flush at end of ada_val_print_1

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.

10 years agoada_val_print_1: Go through val_print instead of recursive call to self.
Joel Brobecker [Thu, 19 Dec 2013 11:27:00 +0000 (15:27 +0400)] 
ada_val_print_1: Go through val_print instead of recursive call to self.

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.

10 years agoada_val_print_1: Add language parameter
Joel Brobecker [Thu, 19 Dec 2013 10:33:20 +0000 (14:33 +0400)] 
ada_val_print_1: Add language parameter

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.

10 years agoada-valprint.c: Reorder functions to reduce advance declarations.
Joel Brobecker [Thu, 19 Dec 2013 10:05:16 +0000 (14:05 +0400)] 
ada-valprint.c: Reorder functions to reduce advance declarations.

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.

10 years ago[python] Add gdb.Type.name attribute.
Joel Brobecker [Mon, 23 Dec 2013 03:18:51 +0000 (07:18 +0400)] 
[python] Add gdb.Type.name attribute.

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.

10 years agoRemove an empty-body 'if' statement
Yao Qi [Sun, 5 Jan 2014 11:32:51 +0000 (19:32 +0800)] 
Remove an empty-body 'if' statement

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.

10 years agoAdd qualifier 'const' to argument args
Yao Qi [Sun, 5 Jan 2014 11:36:51 +0000 (19:36 +0800)] 
Add qualifier 'const' to argument args

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.

10 years agoUse void for empty argument list in trace_me
Yao Qi [Sun, 5 Jan 2014 11:37:53 +0000 (19:37 +0800)] 
Use void for empty argument list in trace_me

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.

10 years agoMake functions static.
Yao Qi [Sun, 5 Jan 2014 11:36:03 +0000 (19:36 +0800)] 
Make functions static.

gdb:

2014-01-07  Yao Qi  <yao@codesourcery.com>

* gnu-nat.c (make_inf) Update declaration.
(make_inf): Make it static.
(inf_set_traced): Likewise.
(inf_port_to_thread, inf_task_died_status): Likewise.

10 years agoRemove declaration of inf_tid_to_proc
Yao Qi [Sun, 5 Jan 2014 07:38:44 +0000 (15:38 +0800)] 
Remove declaration of inf_tid_to_proc

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.

10 years agoFix no previous prototype for '_initialize_gnu_nat' [-Werror=missing-prototypes]
Yao Qi [Sun, 5 Jan 2014 07:05:44 +0000 (15:05 +0800)] 
Fix no previous prototype for '_initialize_gnu_nat' [-Werror=missing-prototypes]

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.

10 years agoUse enum bfd_endian in gdbarch.sh
Yao Qi [Thu, 2 Jan 2014 03:02:56 +0000 (11:02 +0800)] 
Use enum bfd_endian in gdbarch.sh

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.

10 years agodaily update
Alan Modra [Mon, 6 Jan 2014 23:00:48 +0000 (09:30 +1030)] 
daily update

This page took 0.052225 seconds and 4 git commands to generate.