Commit Graph

32896 Commits

Author SHA1 Message Date
Tom Tromey 4229ca0ea6 simple test suite fix in gdb.ada
This changes one spot in gdb.ada to use standard_testfile.

	* gdb.ada/info_types.exp: Use standard_testfile.
2013-07-16 18:52:18 +00:00
Tom Tromey 5ee657d5a2 simple test suite fix in gdb.mi
This is another simple test suite change for the parallelization
project.

This changes mi-basics.exp to avoid the use of subdir and objdir and
instead use standard_output_file.

There are still some uses of objdir, but as noted in a new comment in
the patch, these uses are parallel-safe.

	* gdb.mi/mi-basics.exp: Use standard_output_file.
	(test_dir_specification, test_cwd_specification)
	(test_path_specification): Use testsubdir, not subdir and objdir.
2013-07-16 18:49:32 +00:00
Tom Tromey 20e3d738fe test suite fixlet for gdb.trace
This is a minor fix to clean up the last remaining test suite
parallelization issue in gdb.trace.

mi-traceframe-changed.exp refers to objdir.  This patch changes the
code to have the same effect, but avoid using that variable.

	* gdb.trace/mi-traceframe-changed.exp: Don't use objdir.
2013-07-16 18:48:31 +00:00
Ulrich Weigand 926bf92da5 2013-07-15 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
* ppc-linux-nat.c: Since the new PowerPC specific ptrace interface is
	now available for embedded (BookE) and server (BookS) processors,
	correct mentions of 'booke' and adjust comments accordingly in order to
	avoid confusion. Rename struct 'booke_debug_info' to 'hwdebug_info'.
	(have_ptrace_booke_interface): Rename function and variable
	'have_ptrace_booke_interface' to 'have_ptrace_hwdebug_interface'.
	Rename struct 'booke_debug_info' to 'hwdebug_info'. Update all uses.
	(booke_cmp_hw_point): Rename function 'booke_cmp_hw_point' to
	'hwdebug_point_cmp'. Update all uses.
	(booke_find_thread_points_by_tid): Rename function
	'booke_find_thread_points_by_tid' to
	'hwdebug_find_thread_points_by_tid'. Update all uses.
	(booke_insert_point): Rename function 'booke_insert_point' to
	'hwdebug_insert_point'. Update all uses.
	(booke_remove_point): Rename function 'booke_remove_point' to
	'hwdebug_remove_point'. Update all uses.
2013-07-15 16:01:26 +00:00
Maciej W. Rozycki d929bc19b9 include/elf/
* mips.h (Tag_GNU_MIPS_ABI_FP): Remove comment.
	(Val_GNU_MIPS_ABI_FP_ANY, Val_GNU_MIPS_ABI_FP_DOUBLE,
	Val_GNU_MIPS_ABI_FP_SINGLE, Val_GNU_MIPS_ABI_FP_SOFT,
	Val_GNU_MIPS_ABI_FP_64): New enum.

	bfd/
	* elfxx-mips.c (mips_elf_merge_obj_attributes): Replace hardcoded
	magic numbers with enum values.

	binutils/
	* readelf.c (display_mips_gnu_attribute): Replace hardcoded magic
	numbers with enum values.

	gdb/
	* mips-tdep.c (mips_gdbarch_init): Replace hardcoded magic
	numbers with enum values.
2013-07-15 15:07:30 +00:00
Ali Anwar 054e8d9e20 2013-07-15 Ali Anwar <ali_anwar@codesourcery.com>
PR threads/13217
        * thread.c (thread_apply_all_command): Check for valid threads
        and thread count.
        (thread_array_cleanup): New struct.
        (set_thread_refcount): New function.
2013-07-15 11:14:32 +00:00
Andrew Burgess cf0063592d Reuse print_hex_chars function.
http://sourceware.org/ml/gdb-patches/2013-07/msg00234.html

	* infcmd.c (default_print_one_register_info): Reuse code in
	print_hex_chars.
2013-07-11 09:07:41 +00:00
Tom Tromey 94e36acc3c * Makefile.in (GDB_WARN_CFLAGS_NO_DEFS, ADA_EXP_C): New macros.
(ada-exp.o): New target.
2013-07-10 18:13:52 +00:00
Sergio Durigan Junior 915dd369a2 http://sourceware.org/ml/gdb-patches/2013-07/msg00065.html
Doug Evans committed the change above, but forgot to update one of
the callers of get_raw_print_options, at mt-tdep.c.  This commit fixes
this.

2013-07-10  Sergio Durigan Junior  <sergiodj@redhat.com>

	* mt-tdep.c (mt_registers_info): Call
	get_no_prettyformat_print_options instead of
	get_raw_print_options (regression by last patch from Doug
	Evans).
2013-07-10 03:15:05 +00:00
Joel Brobecker 51b8642693 [testsuite/Ada] Add testing of access to packed arrays.
This patch adds some tests that evidence a regression fixed by
the following patch from Pedro Alves:

    [PATCH] ada-lang.c:coerce_unspec_val_to_type: Preserve laziness
    http://www.sourceware.org/ml/gdb-patches/2013-07/msg00178.html

gdb/testsuite/ChangeLog:

        * gdb.ada/arrayptr/foo.adb: Add some code defining an access
        to a packed array.
        * gdb.ada/arrayptr.exp: Add a few tests using that new access
        to packed array.
2013-07-10 00:35:01 +00:00
Joel Brobecker eca07816f8 ada-lang.c:coerce_unspec_val_to_type: Preserve laziness.
ada-lang.c:coerce_unspec_val_to_type does:

      if (value_lazy (val)
	  || TYPE_LENGTH (type) > TYPE_LENGTH (value_type (val)))
	result = allocate_value_lazy (type);
      else
	{
	  result = allocate_value (type);
	  memcpy (value_contents_raw (result), value_contents (val),
		  TYPE_LENGTH (type));
	}
      set_value_component_location (result, val);
      set_value_bitsize (result, value_bitsize (val));
      set_value_bitpos (result, value_bitpos (val));
      set_value_address (result, value_address (val));
      set_value_optimized_out (result, value_optimized_out (val));

Notice that before value_optimized_out was made to auto-fetch lazy
values, VAL would end up still lazy if it was lazy on entry.  It's not
really a problem here if VAL is lazy, and VAL->optimized_out is 0,
because RESULT is also left lazy.  IOW, this just wants to copy the
VAL->optimized_out flag to RESULT->optimized_out, nothing else.

As a side-effect of the change in value_optimized_out, the following
testcase now regresses. Consider:

       type Small is range -64 .. 63;
       for Small'Size use 7;
       type Arr is array (1..10) of Small;
       pragma Pack (Arr);

       type Arr_Ptr is access Arr;
       An_Arr_Ptr : Arr_Ptr := new Arr'(10, 20, 30, 40, 50, 60, 62, 63,
                                        -23, 42);

    Trying to print one element of An_Arr_Ptr yields:

        (gdb) p an_arr_ptr(3)
        Cannot access memory at address 0x0

The patch adds the value_optimized_out_const function for that,
allowing us to avoid trying to fetch a value at a dummy address.

(I found this out by grepping for set_value_optimized_out and trying
to convert the uses I found to instead allocate the value with
allocate_optimized_out_value.)

Tested on x86_64 Fedora 17.

gdb/
2013-07-09  Pedro Alves  <palves@redhat.com>

	* ada-lang.c (coerce_unspec_val_to_type): Use
	value_optimized_out_const.
	* value.c (value_optimized_out_const): New function.
	* value.h (value_optimized_out_const): New declaration.
2013-07-10 00:34:38 +00:00
Joel Brobecker 7d7c647756 Fix FAIL: gdb.ada/small_reg_param.exp: continue to call_me
If enough information is provided by the compiler, the debugger
now prints the entry value of various parameters:

    (gdb) continue
    Continuing.

    Breakpoint 2, pck.call_me (w=w@entry=50) at [...]
    20            Last_Word := W;

This patch adjusts the expected output to allow an optional
"w@entry=" in the parameter value.

gdb/testsuite/ChangeLog:

        * gdb.ada/small_reg_param.exp: Accept optional entry value
        for parameter "w".
2013-07-10 00:10:37 +00:00
Joel Brobecker 52cd8b7d70 Remove trailing space in gdb.ada/small_reg_param.exp
gdb/testsuite/ChangeLog:

        * gdb.ada/small_reg_param.exp: Remove trailing space.
2013-07-10 00:10:26 +00:00
Doug Evans 2a998fc037 * defs.h (enum val_prettyformat): Renamed from val_prettyprint.
Enum values rename as well.  All uses updated.
	* valprint.h (value_print_options): Rename member pretty to
	pretty format.  Rename member prettyprint_arrays to
	prettyformat_arrays.  Rename member prettyprint_structs to
	prettyformat_structs.  All uses updated.
	(get_no_prettyformat_print_options): Renamed from
	get_raw_print_options.
	* valprint.c (get_no_prettyformat_print_options): Renamed from
	get_raw_print_options.  All callers updated.
	(show_prettyformat_structs): Renamed from show_prettyprint_structs.
	All callers updated.
	(show_prettyformat_arrays): Renamed from show_prettyprint_arrays.
	All callers updated.
	(_initialize_valprint): Improve help text for "set print pretty" and
	"set print arrays".

	testsuite/
	* gdb.base/default.exp: Update expected output of "show print array"
	and "show print pretty".
2013-07-09 16:57:09 +00:00
Andrew Burgess 466c1fcab7 Revert recent changes to value_bits_valid.
http://sourceware.org/ml/gdb-patches/2013-07/msg00243.html

  * value.c (value_bits_valid): Revert previous change, and change
  by Pedro on 2013-07-04, due to regressions in
  gdb.dwarf2/implptr.exp and gdb.dwarf2/pieces.exp.
2013-07-09 14:11:53 +00:00
Ulrich Weigand 0329e9fbe8 2013-07-08 Andreas Arnez <arnez@linux.vnet.ibm.com>
* gdb.threads/wp-replication.exp: Stop counting available hardware
	watchpoints after NR_THREADS iterations.
2013-07-08 11:35:49 +00:00
Andrew Burgess 1953058fe9 Add $gdb_prompt to test regexp.
http://sourceware.org/ml/gdb-patches/2013-07/msg00173.html

	* gdb.python/py-explore.exp: Add $gdb_prompt to test regexp.
2013-07-08 11:16:01 +00:00
Andrew Burgess ad0f030310 Fix bug in value_bits_valid.
http://sourceware.org/ml/gdb-patches/2013-07/msg00174.html

	* value.c (value_bits_valid): If the value is not lval_computed
	or has no check validity handler then the answer is the
	optimized_out flag, otherwise defer to the handler.
2013-07-08 10:21:33 +00:00
Yao Qi 7c0de7419b gdb/testsuite/
* boards/native-gdbserver.exp: Move invoke of
	process_multilib_options to gdbserver-base.exp.
	Move set_board_info 'compiler', 'gdb,noinferiorio',
	'gdb,nofileio', 'gdb_server_prog' and 'gdb,predefined_tsv' to
	gdbserver-base.exp.
	Move proc ${board}_download, ${board}_upload and
	${board}_file to gdbserver-base.exp.
	* boards/native-extended-gdbserver.exp: Likewise.
	* boards/native-stdio-gdbserver.exp: Likewise.
	* boards/gdbserver-base.exp: New file.
2013-07-07 08:52:39 +00:00
Eli Zaretskii 48d1d6f5c6 top.c (print_gdb_configuration): Explain in output of --configuration
what does "relocatable" mean.
2013-07-06 07:34:48 +00:00
Eli Zaretskii b187bec1eb Rearrange --help output.
* main.c (print_gdb_help): Regroup options in the --help text.
	See http://sourceware.org/ml/gdb-patches/2013-04/msg00362.html for
	the relevant discussions.
2013-07-06 07:28:24 +00:00
Yao Qi 52d361e1b3 gdb/
* breakpoint.h (struct breakpoint_ops) <create_breakpoints_sal>:
	Remove parameter 'lsal'.
	* breakpoint.c (create_breakpoint): Move local variable 'lsal'
	to inner block.  Caller update.
	(base_breakpoint_create_breakpoints_sal): Update.
	(bkpt_create_breakpoints_sal): Likewise.
	(tracepoint_create_breakpoints_sal): Likewise.
	(strace_marker_create_breakpoints_sal): Get 'lsal' from the
	element 0 of vector 'canonical->sals'.
2013-07-06 07:14:54 +00:00
Luis Machado e1ec1b420c * rs6000-tdep.c (rs6000_stab_reg_to_regnum): Return the real
register number instead of the pseudo register one.
	(rs6000_dwarf2_reg_to_regnum): Likewise.
2013-07-06 02:46:00 +00:00
Luis Machado 497a4c488f * gdb.base/dump.exp: Remove arch-specific tests and do a
generic data address check to set is64bitonly correctly.
2013-07-06 02:36:46 +00:00
Luis Machado bb3f62fce7 * gdb.mi/gdb2549.exp (register_tests): Expect any decimal for
the register number instead of expecting only 0.
2013-07-06 02:32:31 +00:00
Will Newton 005faa9df8 gdb/testsuite/gdb.base/gnu-ifunc-lib.c: Use %function syntax.
ARM uses @ as a comment character, but % seems to be usable by all
existing ifunc enabled architectures.

gdb/testsuite/ChangeLog:

2013-07-05  Will Newton  <will.newton@linaro.org>

	* gdb.base/gnu-ifunc-lib.c: Use %function instead of @function
	in asm syntax to allow building on ARM.
2013-07-05 10:40:10 +00:00
Yao Qi 4767856f50 gdb/testsuite/
* boards/local-remote-host.exp: Remove obsolete comments.
	* boards/native-extended-gdbserver.exp: Likewise.
	* boards/native-gdbserver.exp: Likewise.
	* boards/native-stdio-gdbserver.exp: Likewise.
2013-07-05 08:50:22 +00:00
Pedro Alves 7195e6f018 Use allocate_optimized_out_value instead of set_value_optimized_out.
Allocate the value as optimized out from the start rather than allocating
a value with contents, and then marking it optimized out.

gdb/
2013-07-04  Pedro Alves  <palves@redhat.com>

	* findvar.c (value_of_register): Use allocate_optimized_out_value
	if the register has been optimized out, instead of
	set_value_optimized_out.
	* frame-unwind.c (frame_unwind_got_optimized): Use
	allocate_optimized_out_value.
2013-07-04 18:10:04 +00:00
Pedro Alves 58722cac5a value_bits_valid: Fix latent bug.
Doing something else, I factored out the bits of the value_bits_valid
function that actually handle the check_validity hook, and
surprisingly found out that the result was misbehaving.  Turns out
value_bits_valid has a latent bug.  If the value is not lval_computed,
or doesn't have a check_validity hook, then we should assume the value
is entirely valid, not invalid.  This is currently masked by the
value->optimized_out check -- I ran the testsuite with a gdb_assert(0)
inserted in place of that return being touched by the patch, and it
never triggers.

Tested on x86_64 Fedora 17.

gdb/
2013-07-04  Pedro Alves  <palves@redhat.com>

	* value.c (value_bits_valid): If the value is not lval_computed,
	or doesn't have a check_validity hook, assume the value is entirely
	valid.
2013-07-04 16:08:22 +00:00
Andrew Burgess 691a26f5dd http://sourceware.org/ml/gdb-patches/2013-07/msg00059.html
gdb/ChangeLog

        * stack.c (read_frame_arg): No longer fetch lazy values.
        * value.c (value_optimized_out): If the value is not already
        marked optimized out, and is lazy then fetch it.
        (value_primitive_field): Move optimized out check to later in the
        function, after we have loaded any lazy values.
        (value_fetch_lazy): Use optimized out flag directly rather than
        calling optimized_out method.

gdb/testsuite/ChangeLog

        * gdb.dwarf2/dw2-reg-undefined.exp: New file.
        * gdb.dwarf2/dw2-reg-undefined.c: Likewise.
        * gdb.dwarf2/dw2-reg-undefined.S: Likewise.
2013-07-04 11:11:25 +00:00
Andrew Burgess a58e2656df http://sourceware.org/ml/gdb-patches/2013-07/msg00056.html
* valops.c: Don't include "user-regs.h".
	(value_fetch_lazy): Moved to value.c.
	* value.c: Include "user-regs.h".
	(value_fetch_lazy): Moved from valops.c.
2013-07-04 09:49:43 +00:00
Yao Qi bd88542004 gdb/
2013-07-04  Yao Qi  <yao@codesourcery.com>

	Revert:
	2013-06-27  Yao Qi  <yao@codesourcery.com>

	* common/create-version.sh: Update comments.  Handle the case
	that TARGET_ALIAS is empty.

gdb/gdbserver/

2013-07-04  Yao Qi  <yao@codesourcery.com>

	* Makefile.in (host_alias): Use @host_noncanonical@.
	(target_alias): Use @target_noncanonical@.
	* configure.ac: Use ACX_NONCANONICAL_TARGET and
	ACX_NONCANONICAL_HOST.
	* configure: Regenerated.

	Revert:
	2013-06-28  Mircea Gherzan  <mircea.gherzan@intel.com>

	* configure.ac (version_host, version_target): Set and AC_SUBST them.
	* configure: Rebuild.
	* Makefile.in (version_host, version_target): Get from configure.
	(version.c): Use $(version_host) and $(version_target).
2013-07-04 01:22:38 +00:00
Pedro Alves 17ef446eed On mainline/development, also link GDBserver with -lmcheck.
This factors --enable-libmcheck related bits from GDB's configure.ac
and makes GDBserver use them too.  Specifically, the 'development'
global is moved to a separate script to it can be sourced by both GDB
and GDBserver, and the --enable-libmcheck/--disable-libmcheck bits
proper are moved to a new m4 file.

I started out by defining 'development' in the m4 file, but in the end
decided against it, as a separate script has the advantage that
changing it in release branches does not require regenerating
configure, unlike today.

I had also started out by making the new GDB_AC_LIBMCHECK itself
handle the yes/no default fallback depending on release/developement,
but since I had split out 'development' to a separate script, and, GDB
needs the python checks anyway (hence we'd need to do the python
checks in gdb's configure.ac, and pass in a 'default lmcheck yes/no'
parameter to GDB_AC_LIBMCHECK anyway), I ended up keeping
GDB_AC_LIBMCHECK isolated from the 'development' global.  IOW, it's
the caller's business to handle it.

Tested on x86_64 Fedora 17.  Built GDB and GDBserver with and without
--enable-libmcheck, and observed --enable-libmcheck overrides the
disablement of -lmcheck caused by python supporting threads, and that
GDBserver links with -lmcheck when expected.  Also observed that
changing the 'development' global, and issuing "make" triggers a
relink, and '-lmcheck' is included or not from the link accordingly.

gdb/
2013-07-03  Pedro Alves  <palves@redhat.com>

	* Makefile.in (config.status): Depend on development.sh.
	(aclocal_m4_deps): Add libmcheck.m4.
	* acinclude.m4: Include libmcheck.m4.
	* configure.ac: Source development.sh instead of setting
	'development' here.  --enable-libmcheck/--disable-libmcheck code
	factored out to GDB_AC_LIBMCHECK.  Run it.
	* development.sh: New file.
	* libmcheck.m4: New file.
	* configure: Regenerate.

gdb/gdbserver/
2013-07-03  Pedro Alves  <palves@redhat.com>

	* Makefile.in (config.status): Depend on development.sh.
	* acinclude.m4: Include libmcheck.m4.
	* configure: Regenerate.
2013-07-03 13:25:46 +00:00
Jan Kratochvil 4d142eaa28 gdb/testsuite/
* gdb.base/break-on-linker-gcd-function.exp: Replace
	prepare_for_testing by build_executable_from_specs and clean_restart.
2013-07-02 20:06:12 +00:00
Tom Tromey ac6dd50fbf * contrib/ari/update-web-ari.sh: Update for version.in change. 2013-07-02 17:58:54 +00:00
Tom Tromey bd1df410dd * common/ptid.h: Comment fixes. 2013-07-02 16:58:51 +00:00
Tom Tromey 3105ebf928 remove mention of "target nrom"
The documentation refers to "target nrom", but this target doesn't
appear in the tree.  It was zapped here:

2002-12-16  Andrew Cagney  <ac131313@redhat.com>
[...]
        * remote-nrom.c, remote-os9k.c, remote-vx960.c: Delete.

This patch removes the reference from the documentation.

	* gdb.texinfo (Target Commands): Don't mention "target nrom".
2013-07-02 16:58:32 +00:00
Mircea Gherzan 7a9a748743 gdbserver, win32: fix some function typedefs
2013-05-25  Mircea Gherzan  <mircea.gherzan@intel.com>

gdbserver/
	* win32-low.c (winapi_DebugActiveProcessStop): Move the WINAPI
	attribute inside the parentheses.
	(winapi_DebugSetProcessKillOnExit): Ditto.
	(winapi_DebugBreakProcess): Ditto.
	(winapi_GenerateConsoleCtrlEvent): Ditto.

Change-Id: I3aab72f2a1725a46b9da0e41a4ba08d7886284b9
Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
2013-07-02 11:59:24 +00:00
Mircea Gherzan 49b64de6e4 gdbserver: avoid empty structs
2013-06-25  Mircea Gherzan  <mircea.gherzan@intel.com>

gdbserver/

	* notif.h (notif_event): Add a dummy member to avoid compiler
	errors.

Change-Id: I490dbdb70a24f52b3947371f7c0397bf7a18423c
Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
2013-07-02 10:08:01 +00:00
Tom Tromey 4db1a1dc03 change gdb to use BFD's "dwz" functions
BFD recently got a few functions related to "dwz" files.  This patch
changes gdb to use them, just to share a bit more code.

This changes dwarf2_get_dwz_file to possibly return NULL.  This
simplified a bit of code elsewhere.

Built and regtested on x86-64 Fedora 18.  I specifically regtested it
using my pending dwz test case.

	* dwarf2read.c (dwarf2_get_dwz_file): Return NULL if
	.gnu_debugaltlink not found.  Use bfd_get_alt_debug_link_info.
	(dwarf2_read_index, create_all_comp_units): Update.
2013-07-01 19:55:17 +00:00
Tom Tromey dd9aa0484e add -Wold-style-definition
This adds -Wold-style-definition to gdb's list of warnings.  This
found a couple of spots where "()" was used where "(void)" is more
correct.

Tested by rebuilding on x86-64 Fedora 18.

	* configure.ac (build_warnings): Add -Wold-style-definition.
	* configure: Rebuild.
	* machoread.c (_initialize_machoread): Use "(void)".
	* macrocmd.c (macro_inform_no_debuginfo): Fix formatting;
	use "(void)".
2013-07-01 19:52:32 +00:00
Tom Tromey 44d100c3b9 add -Wold-style-declaration
This adds -Wold-style-declaration to gdb's list of warnings.

It turns out that a few places use "const static" rather than
"static const".  The former is deprecated according to the C standard.

Tested by rebuilding with --enable-targets=all on x86-64 Fedora 18.

	* configure.ac (build_warnings): Add -Wold-style-declaration.
	* configure: Rebuild.
	* dsrec.c (make_srec): Use "static const", not "const static".
	* h8300-tdep.c (h8300_breakpoint_from_pc): Use "static const",
	not "const static".
	* mi/mi-parse.c (mi_no_values, mi_simple_values, mi_all_values):
	Use "static const", not "const static".
	* mn10300-tdep.c (mn10300_breakpoint_from_pc): Use "static const",
	not "const static".
	* moxie-tdep.c (moxie_breakpoint_from_pc): Use "static const",
	not "const static".
	* rs6000-tdep.c (rs6000_breakpoint_from_pc): Use "static const",
	not "const static".
	* v850-tdep.c (v850_breakpoint_from_pc): Use "static const",
	not "const static".
	(v850_dbtrap_breakpoint_from_pc): Likewise.
	* xstormy16-tdep.c (xstormy16_breakpoint_from_pc): Use "static const",
	not "const static".
2013-07-01 19:50:11 +00:00
Tom Tromey 2945b8076c add -Wmissing-parameter-type
This adds -Wmissing-parameter-type to gdb's list of warnings.

This one doesn't happen to trigger for a --enable-targets=all build on
x86-64 Fedora 18.

	* configure.ac (build_warnings): Add -Wmissing-parameter-type.
	* configure: Rebuild.
2013-07-01 19:48:05 +00:00
Pedro Alves d5749ee715 [GDBserver] hostio.c: Fallback to packet buffer size if PATH_MAX is not available.
PATH_MAX is not defined on systems which have no limit on filename
length, such as GNU/Hurd.  As designed, the hostio RSP packets carry
the paths as parameters in the request/reply packets, which themselves
have an upper size limit, so lifting the filename limit completely
would require a redesign with new hostio packets.  While that doesn't
happen, we can at least support filename lengths as long as the packet
buffer can fit.

gdb/gdbserver/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* hostio.c (HOSTIO_PATH_MAX): Define.
	(require_filename, handle_open, handle_unlink, handle_readlink):
	Use it.
2013-07-01 11:29:17 +00:00
Pedro Alves d8d2a3ee47 Normalize on PATH_MAX instead of MAXPATHLEN throughout.
With the pathmax gnulib module in place, we can use PATH_MAX
consistently throughout, instead of the current mixbag of PATH_MAX and
MAXPATHLEN uses.  It's no longer necessary to include sys/param.h
(supposedly, I can't check all ports touched here) for MAXPATHLEN.

Don't remove sys/param.h from GDB's configure.ac, as later tests in
the file use HAVE_SYS_PARAM_H checks.

Tested on x86_64 Fedora 17.

Also cross-built for --host=i686-w64-mingw32, and --host=i586-pc-msdosdjgpp.

gdb/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* defs.h: Include "pathmax.h".
	* utils.c: Don't include sys/param.h.
	(gdb_realpath): Remove code that checks for MAXPATHLEN.
	* solib-ia64-hpux.c (ia64_hpux_handle_load_event): Use PATH_MAX
	instead of MAXPATHLEN.
	* solib-sunos.c: Don't include sys/param.h.
	* xcoffread.c: Don't include sys/param.h.
	* bsd-kvm.c: Don't include sys/param.h.
	* darwin-nat.c: Don't include sys/param.h.
	(darwin_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN.
	* darwin-nat-info.c: Don't include sys/param.h.
	* fbsd-nat.c (fbsd_pid_to_exec_file): Use PATH_MAX instead of
	MAXPATHLEN.
	* i386obsd-nat.c: Don't include sys/param.h.
	* inf-child.c: Don't include sys/param.h.
	(inf_child_fileio_readlink): Use PATH_MAX instead of MAXPATHLEN.
	* linux-fork.c: Don't include sys/param.h.
	(fork_save_infrun_state): Use PATH_MAX instead of MAXPATHLEN.
	* linux-nat.c: Don't include sys/param.h.
	(linux_child_pid_to_exec_file, linux_proc_pending_signals)
	(linux_proc_pending_signals): Use PATH_MAX instead of MAXPATHLEN.
	* m68klinux-nat.c: Don't include sys/param.h.
	* nbsd-nat.c: Don't include sys/param.h.
	(nbsd_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN.
	* ppc-linux-nat.c: Don't include sys/param.h.
	* rs6000-nat.c: Don't include sys/param.h.
	* spu-linux-nat.c. Don't include sys/param.h.
	* windows-nat.c: Don't include sys/param.h.
	* xtensa-linux-nat.c: Don't include sys/param.h.
	* config/i386/nm-fbsd.h: Don't include sys/param.h.

gdb/gdbserver/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* server.h: Include "pathmax.h".
	* linux-low.c: Don't include sys/param.h.
	(linux_pid_exe_is_elf_64_file): Use PATH_MAX instead of
	MAXPATHLEN.
	* win32-low.c: Don't include sys/param.h.
	(win32_create_inferior): Use PATH_MAX instead of MAXPATHLEN.
2013-07-01 11:28:30 +00:00
Pedro Alves 38ec22075a Import the "pathmax" gnulib module.
This imports the "pathmax" gnulib module, making PATH_MAX always
available on systems that have the notion of a constant max path limit
(i.e., practically everywhere except the Hurd), along with fixing a
couple broken systems --- see pathmax.h in the patch.

This means we can normalize on PATH_MAX throughout the tree (instead
of some places using MAXPATHLEN, or defining fallback constants
ourselves).

This is the just the importing step.

gdb/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add pathmax.
	* gnulib/Makefile.in (aclocal_m4_deps): Add import/m4/pathmax.m4.
	* gnulib/aclocal.m4: Regenerate.
	* gnulib/config.in: Regenerate.
	* gnulib/configure: Regenerate.
	* gnulib/import/pathmax.h: New file.
	* gnulib/import/Makefile.am: Regenerate.
	* gnulib/import/Makefile.in: Regenerate.
	* gnulib/import/m4/gnulib-cache.m4: Regenerate.
	* gnulib/import/m4/gnulib-comp.m4: Regenerate.
	* gnulib/import/m4/pathmax.m4: New file.
2013-07-01 11:25:43 +00:00
Pedro Alves e655c1a2f5 Reimplement DJGPP's .gdbinit -> gdb.ini renaming.
This simplifies the .gdbinit filename selection logic.

We have a GDBINIT_FILENAME define that supposedly configurations would
override, but none do so.  Instead, the only configuration that wants
a different file name instead of ".gdbinit", djgpp, does a strcpy over
the gdbinit global array.  This means the array needs to be sized, and
the code that does that is doing the usual
'PATH_MAX/FILENAME_MAX/fallback constant/etc.' mess.

Instead of all that, it's much simpler to have configure specificy the
.gdbinit filename.  As bonus, we can then make the "gdbinit" global
array const.

gdb/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* configure.ac (GDBINIT): Define, depending on host.
	* go32-nat.c (init_go32_ops): Don't override gdbinit here.
	* top.c (PATH_MAX): Delete fallback definition.
	(GDBINIT_FILENAME): Delete.
	(gdbinit): Reimplement as const char array set to the GDBINIT
	string constant.
	* top.h (gdbinit): Make const.
2013-07-01 11:24:17 +00:00
Pedro Alves 50dd979345 Constify main.c:get_init_files.
A following patch will want to make the "gdbinit" global array const.
As usual, that forces in a cascading series of const additions.  This
patch preemptively does those.  I went all the way up to constifying
catch_command_errors, but then that would require constifying
execute_command as well (which is a much more significant effort).  So
as stop point, I found the cleanest would be to add a variant of
catch_command_errors that takes const args, and use that in the few
spots that needed it due to the the get_init_files constification.

gdb/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* cli/cli-cmds.c (source_script): Make 'file' parameter const.
	* cli/cli-cmds.h (source_script): Likewise.
	* exceptions.c (catch_command_errors_const): New function.
	* exceptions.h (catch_command_errors_const): Declare.
	* main.c (get_init_files): Make parameters const, and adjust.
	(captured_main): Make 'system_gdbinit', 'home_gdbinit' and
	'local_gdbinit' locals const.  Adjust to use
	catch_command_errors_const.
	(print_gdb_help): Make 'system_gdbinit', 'home_gdbinit' and
	'local_gdbinit' locals const.
2013-07-01 11:22:12 +00:00
Pedro Alves bc7dea8de9 Rely on gnulib's unistd.h replacement.
With gnulib's unistd module, we can assume unistd.h is always present, and that
STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO are always defined.

Don't remove unistd.h from GDB's configure.ac, as later tests in the
file use HAVE_UNISTD_H checks.

gdb/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* defs.h: Don't check HAVE_UNISTD_H before including <unistd.h>.
	(STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO): Delete.
	* tracepoint.c: Don't check HAVE_UNISTD_H before including
	<unistd.h>.

gdb/gdbserver/
2013-07-01  Pedro Alves  <palves@redhat.com>

	* event-loop.c: Don't check HAVE_UNISTD_H before including
	<unistd.h>.
	* gdbreplay.c: Likewise.
	* remote-utils.c: Likewise.
	* server.c: Likewise.
	* configure.ac: Don't check for unistd.h.
	* configure: Regenerate.
2013-07-01 11:19:27 +00:00
Pedro Alves 8839a007ad Import the "unistd" gnulib module.
I wanted to import the pathmax module, and that pulls in the unistd
module as dependency.  The unistd module is actually bigger than the
pathmax module.  If we're going to end up with it, might as well
import it explicitly, and make use of it throughout.

The "unistd" module makes a GNU-like <unistd.h> always available.
This means we no longer need to do:

 +#ifdef HAVE_UNISTD_H
  #include <unistd.h>
 +#endif

and we can remove a few constants from defs.h.

This is just the importing step.

gdb/
2013-07-01  Pedro Alves  <palves@redhat.com>

	Import the "unistd" gnulib module.
	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add "unistd".
	* gnulib/Makefile.in (aclocal_m4_deps): Add import/m4/off_t.m4,
	import/m4/ssize_t.m4, import/m4/sys_types_h.m4 and
	import/m4/unistd_h.m4.
	* gnulib/aclocal.m4: Renenerate.
	* gnulib/config.in: Renenerate.
	* gnulib/configure: Renenerate.
	* gnulib/import/Makefile.am: Renenerate.
	* gnulib/import/Makefile.in: Renenerate.
	* gnulib/import/m4/gnulib-cache.m4: Renenerate.
	* gnulib/import/m4/gnulib-comp.m4: Renenerate.
	* gnulib/import/m4/off_t.m4: New file.
	* gnulib/import/m4/ssize_t.m4: New file.
	* gnulib/import/m4/sys_types_h.m4: New file.
	* gnulib/import/m4/unistd_h.m4: New file.
	* gnulib/import/sys_types.in.h: New file.
	* gnulib/import/unistd.c: New file.
	* gnulib/import/unistd.in.h: New file.
2013-07-01 11:18:09 +00:00