Commit Graph

9 Commits

Author SHA1 Message Date
Sandra Loosemore f489207efd Fix stepping past unwritable kernel helper on nios2-linux-gnu.
This patch fixes a problem on nios2-linux-gnu with stepping past the
kernel helper __kuser_cmpxchg, which was exposed by the testcase
gdb.threads/watchpoint-fork.exp.  The kernel maps this function into
user space on an unwritable page.  In this testcase, the cmpxchg
helper is invoked indirectly from the setbuf call in the test program.
Since this target lacks hardware breakpoint/watchpoint support, GDB
tries to single-step through the program by setting software
breakpoints, and was just giving an error when it reached the function
on the unwritable page.

The solution here is to always step over the call instead of stepping
into it; cmpxchg is supposed to be an atomic operation so this
behavior seems reasonable.  The hook in nios2_get_next_pc is somewhat
generic, but at present cmpxchg is the only helper provided by the
Linux kernel that is invoked by an ordinary function call.  (Signal
return trampolines also go through the unwritable page but not by a
function call.)

Fixing this issue also revealed that the testcase needs a much larger
timeout factor when software single-stepping is used.  That has also
been fixed in this patch.

gdb/ChangeLog

2019-03-28  Sandra Loosemore  <sandra@codesourcery.com>

        * nios2-tdep.h (struct gdbarch_tdep): Add is_kernel_helper.
        * nios2-tdep.c (nios2_get_next_pc): Skip over kernel helpers.
        * nios2-linux-tdep.c (nios2_linux_is_kernel_helper): New.
        (nios2_linux_init_abi): Install it.

gdb/testsuite/ChangeLog

2019-03-28  Sandra Loosemore  <sandra@codesourcery.com>

        * gdb.threads/watchpoint-fork.exp (test): Use large timeout
        factor when no hardware watchpoint support.
2019-03-28 09:29:22 -07:00
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Sandra Loosemore af60a1ef46 Nios II R2 support for GDB.
2015-08-03  Sandra Loosemore  <sandra@codesourcery.com>

	gdb/
	* nios2-tdep.h: Include opcode/nios2.h here.
	(NIOS2_CDX_OPCODE_SIZE): New.
	(struct gdbarch_tdep): Add OP parameter to syscall_next_pc.
	* nios2-tdep.c: Don't include opcode/nios2.h here.
	(nios2_fetch_insn): For R2, try reading 2-byte instruction if
	4-byte read fails.
	(nios2_match_add, nios2_match_sub): Add cases for R2 encodings.
	(nios2_match_addi, nios2_match_orhi): Likewise.
	(nios2_match_stw, nios2_match_ldw): Likewise.
	(nios2_match_rdctl): Likewise.
	(nios2_match_stwm, nios2_match_ldwm): New.
	(nios2_match_branch): Add cases for R2 encodings.
	(nios2_match_jmpi, nios2_match_calli): Likewise.
	(nios2_match_jmpr, nios2_match_callr): Likewise.
	(nios2_match_break, nios2_match_trap): Likewise.
	(nios2_in_epilogue_p): Add R2 support.
	(nios2_analyze_prologue): Update comments.  Recognize R2 CDX
	prologues.
	(nios2_breakpoint_from_pc): Handle R2 instructions.
	(nios2_get_next_pc): Likewise.  Adjust call to
	tdep->syscall_next_pc.
	* nios2-linux-tdep.c (nios2_r1_linux_rt_sigreturn_tramp_frame):
	Renamed from nios2_linux_rt_sigreturn_tramp_frame.  Use
	instruction field macros instead of literal hex values.
	(nios2_r2_linux_rt_sigreturn_tramp_frame): New.
	(nios2_linux_syscall_next_pc): Adjust signature to pass OP.
	Use size field from OP instead of assuming all instructions
	are the same size.
	(nios2_linux_init_abi): Register appropriate unwinder for mach.

	gdb/gdbserver/
	* linux-nios2-low.c (NIOS2_BREAKPOINT): Conditionalize for
	arch variant.
	(CDX_BREAKPOINT): Define for R2.
	(nios2_breakpoint_at): Check for CDX_BREAKPOINT when R2.
	(the_low_target): Add comments.
2015-08-03 11:39:52 -07:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Sandra Loosemore a1217d97c4 2013-05-06 Sandra Loosemore <sandra@codesourcery.com>
Andrew Jenner  <andrew@codesourcery.com>
	    Chung-Lin Tang  <cltang@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	Based on the nios2-elf port from Altera Corporation.

	gdb/
	* Makefile.in (ALL_TARGET_OBS): Add nios2-tdep.o and
	nios2-linux-tdep.o.
	(HFILES_NO_SRCDIR): Add nios2-tdep.h.
	(ALLDEPFILES): Add nios2-tdep.c and nios2-linux-tdep.c.
	* configure.tgt: Add nios2*-*-linux* and nios2*-*-* targets.
	* nios2-tdep.h: New.
	* nios2-tdep.c: New.
	* nios2-linux-tdep.c: New.
	* features/Makefile (WHICH): Add nios2-linux.
	(nios2-linux-expedite): Set.
	* features/nios2-cpu.xml: New.
	* features/nios2.xml: New.
	* features/nios2-linux.xml: New.
	* features/nios2.c: New (autogenerated).
	* features/nios2-linux.c: New (autogenerated).
	* regformats/nios2-linux.dat: New (autogenerated).
	* NEWS (Changes since GDB 7.6): Add new Nios II targets
	and commands.

	gdb/doc/
	* gdb.texinfo (Nios II): New section.
	(Nios II Features): New section.
2013-05-07 01:09:29 +00:00