Blame SOURCES/gdb-upstream.patch

861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00056.html
861f93
861f93
### src/gdb/ChangeLog	2013/04/05 19:17:15	1.15370
861f93
### src/gdb/ChangeLog	2013/04/05 20:01:32	1.15371
861f93
## -1,5 +1,12 @@
861f93
 2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 
861f93
+	Convert man pages to texinfo, new gdbinit.5 texinfo page.
861f93
+	* Makefile.in (gdb.z): Remove.
861f93
+	(install-only): Remove $(man1dir) and gdb.1 installation.
861f93
+	* gdb.1: Remove.
861f93
+
861f93
+2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+
861f93
 	Fix compatibility with Linux kernel 3.8.3.
861f93
 	* linux-tdep.c (linux_find_memory_regions_full): Move variable number
861f93
 	to more inner block.  Remove parsing of NUMBER from outer block.
861f93
--- src/gdb/Makefile.in	2013/04/05 13:24:24	1.1246
861f93
+++ src/gdb/Makefile.in	2013/04/05 20:01:33	1.1247
861f93
@@ -1019,11 +1019,6 @@
861f93
 info install-info clean-info dvi pdf install-pdf html install-html: force
861f93
 	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
861f93
 
861f93
-gdb.z:gdb.1
861f93
-	nroff -man $(srcdir)/gdb.1 | col -b > gdb.t
861f93
-	pack gdb.t ; rm -f gdb.t
861f93
-	mv gdb.t.z gdb.z
861f93
-
861f93
 # Traditionally "install" depends on "all".  But it may be useful
861f93
 # not to; for example, if the user has made some trivial change to a
861f93
 # source file and doesn't care about rebuilding or just wants to save the
861f93
@@ -1043,10 +1038,6 @@
861f93
 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(bindir) ; \
861f93
 		$(INSTALL_PROGRAM) gdb$(EXEEXT) \
861f93
 			$(DESTDIR)$(bindir)/$$transformed_name$(EXEEXT) ; \
861f93
-		$(SHELL) $(srcdir)/../mkinstalldirs \
861f93
-			$(DESTDIR)$(man1dir) ; \
861f93
-		$(INSTALL_DATA) $(srcdir)/gdb.1 \
861f93
-			$(DESTDIR)$(man1dir)/$$transformed_name.1 ; \
861f93
 		$(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(includedir)/gdb ; \
861f93
 		$(INSTALL_DATA) jit-reader.h $(DESTDIR)$(includedir)/gdb/jit-reader.h
861f93
 	@$(MAKE) DO=install "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do
861f93
### src/gdb/doc/ChangeLog	2013/04/02 17:52:08	1.1432
861f93
### src/gdb/doc/ChangeLog	2013/04/05 20:01:33	1.1433
861f93
## -1,3 +1,22 @@
861f93
+2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+
861f93
+	Convert man pages to texinfo, new gdbinit.5 texinfo page.
861f93
+	* Makefile.in (mandir, man1dir, man5dir, SYSTEM_GDBINIT, MANCONF,
861f93
+	(TEXI2POD, POD2MAN1, POD2MAN5, MAN1S, MAN5S, MANS, man): New.
861f93
+	(diststuff): Add man.
861f93
+	(install-man, install-man1, install-man5, uninstall-man, uninstall-man1)
861f93
+	(uninstall-man5): New.
861f93
+	(STAGESTUFF): Add *.1 and *.5.
861f93
+	(GDBvn.texi): Add SYSTEM_GDBINIT.
861f93
+	(gdb.1, gdbserver.1, gdbinit.5): New.
861f93
+	(maintainer-clean realclean): Add $(MANS).
861f93
+	(install): Add install-man.
861f93
+	(uninstall): Add uninstall-man.
861f93
+	* gdb.texinfo (@include gdb-cfg.texi): Wrap it by @c man begin INCLUDE.
861f93
+	(@copying): Wrap it by @c man begin COPYRIGHT.
861f93
+	(Top): Add Man Pages.
861f93
+	(Man Pages, gdb man, gdbserver man, gdbinit man): New.
861f93
+
861f93
 2013-04-02  Pedro Alves  <palves@redhat.com>
861f93
 
861f93
 	* gdb.texinfo (Debugging Output): Document "set/show debug
861f93
--- src/gdb/doc/Makefile.in	2013/01/01 06:32:56	1.57
861f93
+++ src/gdb/doc/Makefile.in	2013/04/05 20:01:33	1.58
861f93
@@ -26,6 +26,9 @@
861f93
 docdir = @docdir@
861f93
 pdfdir = @pdfdir@
861f93
 htmldir = @htmldir@
861f93
+mandir = @mandir@
861f93
+man1dir = $(mandir)/man1
861f93
+man5dir = $(mandir)/man5
861f93
 
861f93
 SHELL = @SHELL@
861f93
 
861f93
@@ -35,6 +38,8 @@
861f93
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
861f93
 INSTALL_DATA = @INSTALL_DATA@
861f93
 
861f93
+SYSTEM_GDBINIT = @SYSTEM_GDBINIT@
861f93
+
861f93
 mkinstalldirs = $(SHELL) $(srcdir)/../../mkinstalldirs
861f93
 
861f93
 # main GDB source directory
861f93
@@ -160,6 +165,22 @@
861f93
 	$(ANNOTATE_DOC_SOURCE_INCLUDES) \
861f93
 	$(ANNOTATE_DOC_BUILD_INCLUDES)
861f93
 
861f93
+# Options to extract the man page from gdb.texinfo
861f93
+MANCONF = -Dman
861f93
+
861f93
+TEXI2POD = perl $(srcdir)/../../etc/texi2pod.pl \
861f93
+		$(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS)
861f93
+
861f93
+POD2MAN1 = pod2man --center="GNU Development Tools" \
861f93
+		   --release="gdb-$(VERSION)" --section=1
861f93
+POD2MAN5 = pod2man --center="GNU Development Tools" \
861f93
+		   --release="gdb-$(VERSION)" --section=5
861f93
+
861f93
+# List of man pages generated from gdb.texi
861f93
+MAN1S = gdb.1 gdbserver.1
861f93
+MAN5S = gdbinit.5
861f93
+MANS = $(MAN1S) $(MAN5S)
861f93
+
861f93
 #### Host, target, and site specific Makefile fragments come in here.
861f93
 ###
861f93
 
861f93
@@ -170,8 +191,9 @@
861f93
 ps: gdb.ps gdbint.ps stabs.ps refcard.ps annotate.ps
861f93
 html: $(HTMLFILES)
861f93
 pdf: $(PDFFILES)
861f93
+man: $(MANS)
861f93
 all-doc: info dvi ps # pdf
861f93
-diststuff: info
861f93
+diststuff: info man
861f93
 	rm -f gdb-cfg.texi GDBvn.texi
861f93
 
861f93
 install-info: $(INFO_DEPS)
861f93
@@ -242,7 +264,49 @@
861f93
 	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
861f93
 	done
861f93
 
861f93
-STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf
861f93
+install-man: install-man1 install-man5
861f93
+
861f93
+install-man1: $(MAN1S)
861f93
+	test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)"
861f93
+	@list='$(MANS)'; for p in $$list; do \
861f93
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
861f93
+	  f=`echo $$p | sed -e 's|^.*/||'`; \
861f93
+	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \
861f93
+	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(man1dir)/$$f"; \
861f93
+	done
861f93
+
861f93
+install-man5: $(MAN5S)
861f93
+	test -z "$(man5dir)" || $(mkinstalldirs) "$(DESTDIR)$(man5dir)"
861f93
+	@list='$(MANS)'; for p in $$list; do \
861f93
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
861f93
+	  f=`echo $$p | sed -e 's|^.*/||'`; \
861f93
+	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man5dir)/$$f'"; \
861f93
+	  $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(man5dir)/$$f"; \
861f93
+	done
861f93
+
861f93
+uninstall-man: uninstall-man1 uninstall-man5
861f93
+
861f93
+uninstall-man1:
861f93
+	@test -n "$(man1dir)" || exit 0; \
861f93
+	files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \
861f93
+	  sed -n '/\.1[a-z]*$$/p'; \
861f93
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
861f93
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
861f93
+	test -z "$$files" || { \
861f93
+	  echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
861f93
+	  cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
861f93
+
861f93
+uninstall-man5:
861f93
+	@test -n "$(man5dir)" || exit 0; \
861f93
+	files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \
861f93
+	  sed -n '/\.5[a-z]*$$/p'; \
861f93
+	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
861f93
+	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
861f93
+	test -z "$$files" || { \
861f93
+	  echo " ( cd '$(DESTDIR)$(man5dir)' && rm -f" $$files ")"; \
861f93
+	  cd "$(DESTDIR)$(man5dir)" && rm -f $$files; }
861f93
+
861f93
+STAGESTUFF = *.info* gdb-all.texi GDBvn.texi *.ps *.dvi *.pdf *.1 *.5
861f93
 
861f93
 # Copy the object files from a particular stage into a subdirectory.
861f93
 stage1: force
861f93
@@ -313,6 +377,9 @@
861f93
 	if test -z "$(READLINE_TEXI_INCFLAG)"; then \
861f93
 	  echo "@set SYSTEM_READLINE" >> ./GDBvn.new; \
861f93
 	fi
861f93
+	if [ -n "$(SYSTEM_GDBINIT)" ]; then \
861f93
+	  echo "@set SYSTEM_GDBINIT $(SYSTEM_GDBINIT)" >> ./GDBvn.new; \
861f93
+	fi
861f93
 	mv GDBvn.new GDBvn.texi
861f93
 
861f93
 # Updated atomically
861f93
@@ -523,6 +590,28 @@
861f93
 annotate/index.html: $(ANNOTATE_DOC_FILES)
861f93
 	$(MAKEHTML) $(MAKEHTMLFLAGS) -I $(srcdir) $(srcdir)/annotate.texinfo
861f93
 
861f93
+# Man pages
861f93
+gdb.1: $(GDB_DOC_FILES)
861f93
+	touch $@
861f93
+	-$(TEXI2POD) $(MANCONF) -Dgdb < gdb.texinfo > gdb.pod
861f93
+	-($(POD2MAN1) gdb.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
861f93
+		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
861f93
+	rm -f gdb.pod
861f93
+
861f93
+gdbserver.1: $(GDB_DOC_FILES)
861f93
+	touch $@
861f93
+	-$(TEXI2POD) $(MANCONF) -Dgdbserver < gdb.texinfo > gdbserver.pod
861f93
+	-($(POD2MAN1) gdbserver.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
861f93
+		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
861f93
+	rm -f gdbserver.pod
861f93
+
861f93
+gdbinit.5: $(GDB_DOC_FILES)
861f93
+	touch $@
861f93
+	-$(TEXI2POD) $(MANCONF) -Dgdbinit < gdb.texinfo > gdbinit.pod
861f93
+	-($(POD2MAN5) gdbinit.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
861f93
+		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
861f93
+	rm -f gdbinit.pod
861f93
+
861f93
 force:
861f93
 
861f93
 Makefile: Makefile.in $(host_makefile_frag) ../config.status
861f93
@@ -551,8 +640,8 @@
861f93
 # "clean" or "distclean".  Use maintainer-clean to remove them.
861f93
 
861f93
 maintainer-clean realclean: distclean
861f93
-	rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf
861f93
+	rm -f GDBvn.texi *.info* *.dvi *.ps *.html *.pdf $(MANS)
861f93
 
861f93
-install: install-info
861f93
+install: install-info install-man
861f93
 
861f93
-uninstall: uninstall-info
861f93
+uninstall: uninstall-info uninstall-man
861f93
--- src/gdb/doc/gdb.texinfo	2013/04/02 17:52:08	1.1069
861f93
+++ src/gdb/doc/gdb.texinfo	2013/04/05 20:01:33	1.1070
861f93
@@ -6,7 +6,9 @@
861f93
 @c of @set vars.  However, you can override filename with makeinfo -o.
861f93
 @setfilename gdb.info
861f93
 @c
861f93
+@c man begin INCLUDE
861f93
 @include gdb-cfg.texi
861f93
+@c man end
861f93
 @c
861f93
 @settitle Debugging with @value{GDBN}
861f93
 @setchapternewpage odd
861f93
@@ -46,6 +48,7 @@
861f93
 @end direntry
861f93
 
861f93
 @copying
861f93
+@c man begin COPYRIGHT
861f93
 Copyright @copyright{} 1988-2013 Free Software Foundation, Inc.
861f93
 
861f93
 Permission is granted to copy, distribute and/or modify this document
861f93
@@ -58,6 +61,7 @@
861f93
 (a) The FSF's Back-Cover Text is: ``You are free to copy and modify
861f93
 this GNU Manual.  Buying copies from GNU Press supports the FSF in
861f93
 developing GNU and promoting software freedom.''
861f93
+@c man end
861f93
 @end copying
861f93
 
861f93
 @ifnottex
861f93
@@ -179,6 +183,7 @@
861f93
                                  the operating system
861f93
 * Trace File Format::		GDB trace file format
861f93
 * Index Section Format::        .gdb_index section format
861f93
+* Man Pages::			Manual pages
861f93
 * Copying::			GNU General Public License says
861f93
                                 how you can copy and share GDB
861f93
 * GNU Free Documentation License::  The license for this documentation
861f93
@@ -41597,6 +41602,497 @@
861f93
   @}
861f93
 @end smallexample
861f93
 
861f93
+@node Man Pages
861f93
+@appendix Manual pages
861f93
+@cindex Man pages
861f93
+
861f93
+@menu
861f93
+* gdb man::                     The GNU Debugger man page
861f93
+* gdbserver man::               Remote Server for the GNU Debugger man page
861f93
+* gdbinit man::                 gdbinit scripts
861f93
+@end menu
861f93
+
861f93
+@node gdb man
861f93
+@heading gdb man
861f93
+
861f93
+@c man title gdb The GNU Debugger
861f93
+
861f93
+@c man begin SYNOPSIS gdb
861f93
+gdb [@option{-help}] [@option{-nh}] [@option{-nx}] [@option{-q}]
861f93
+[@option{-batch}] [@option{-cd=}@var{dir}] [@option{-f}]
861f93
+[@option{-b}@w{ }@var{bps}]
861f93
+    [@option{-tty=}@var{dev}] [@option{-s} @var{symfile}]
861f93
+[@option{-e}@w{ }@var{prog}] [@option{-se}@w{ }@var{prog}]
861f93
+[@option{-c}@w{ }@var{core}] [@option{-x}@w{ }@var{cmds}]
861f93
+    [@option{-d}@w{ }@var{dir}] [@var{prog}|@var{core}|@var{procID}]
861f93
+@c man end
861f93
+
861f93
+@c man begin DESCRIPTION gdb
861f93
+The purpose of a debugger such as @value{GDBN} is to allow you to see what is
861f93
+going on ``inside'' another program while it executes -- or what another
861f93
+program was doing at the moment it crashed.
861f93
+
861f93
+@value{GDBN} can do four main kinds of things (plus other things in support of
861f93
+these) to help you catch bugs in the act:
861f93
+
861f93
+@itemize @bullet
861f93
+@item
861f93
+Start your program, specifying anything that might affect its behavior.
861f93
+
861f93
+@item
861f93
+Make your program stop on specified conditions.
861f93
+
861f93
+@item
861f93
+Examine what has happened, when your program has stopped.
861f93
+
861f93
+@item
861f93
+Change things in your program, so you can experiment with correcting the
861f93
+effects of one bug and go on to learn about another.
861f93
+@end itemize
861f93
+
861f93
+You can use @value{GDBN} to debug programs written in C, C@t{++}, and Modula-2.
861f93
+Fortran support will be added when a GNU Fortran compiler is ready.
861f93
+
861f93
+@value{GDBN} is invoked with the shell command @code{gdb}.  Once started, it reads
861f93
+commands from the terminal until you tell it to exit with the @value{GDBN}
861f93
+command @code{quit}.  You can get online help from @value{GDBN} itself
861f93
+by using the command @code{help}.
861f93
+
861f93
+You can run @code{gdb} with no arguments or options; but the most
861f93
+usual way to start @value{GDBN} is with one argument or two, specifying an
861f93
+executable program as the argument:
861f93
+
861f93
+@smallexample
861f93
+gdb program
861f93
+@end smallexample
861f93
+
861f93
+You can also start with both an executable program and a core file specified:
861f93
+
861f93
+@smallexample
861f93
+gdb program core
861f93
+@end smallexample
861f93
+
861f93
+You can, instead, specify a process ID as a second argument, if you want
861f93
+to debug a running process:
861f93
+
861f93
+@smallexample
861f93
+gdb program 1234
861f93
+@end smallexample
861f93
+
861f93
+@noindent
861f93
+would attach @value{GDBN} to process @code{1234} (unless you also have a file
861f93
+named @file{1234}; @value{GDBN} does check for a core file first).
861f93
+
861f93
+Here are some of the most frequently needed @value{GDBN} commands:
861f93
+
861f93
+@c pod2man highlights the right hand side of the @item lines.
861f93
+@table @env
861f93
+@item break [@var{file}:]@var{functiop}
861f93
+Set a breakpoint at @var{function} (in @var{file}).
861f93
+
861f93
+@item run [@var{arglist}]
861f93
+Start your program (with @var{arglist}, if specified).
861f93
+
861f93
+@item bt
861f93
+Backtrace: display the program stack.
861f93
+
861f93
+@item print @var{expr}
861f93
+Display the value of an expression.
861f93
+
861f93
+@item c
861f93
+Continue running your program (after stopping, e.g. at a breakpoint).
861f93
+
861f93
+@item next
861f93
+Execute next program line (after stopping); step @emph{over} any
861f93
+function calls in the line.
861f93
+
861f93
+@item edit [@var{file}:]@var{function}
861f93
+look at the program line where it is presently stopped.
861f93
+
861f93
+@item list [@var{file}:]@var{function}
861f93
+type the text of the program in the vicinity of where it is presently stopped.
861f93
+
861f93
+@item step
861f93
+Execute next program line (after stopping); step @emph{into} any
861f93
+function calls in the line.
861f93
+
861f93
+@item help [@var{name}]
861f93
+Show information about @value{GDBN} command @var{name}, or general information
861f93
+about using @value{GDBN}.
861f93
+
861f93
+@item quit
861f93
+Exit from @value{GDBN}.
861f93
+@end table
861f93
+
861f93
+@ifset man
861f93
+For full details on @value{GDBN},
861f93
+see @cite{Using GDB: A Guide to the GNU Source-Level Debugger},
861f93
+by Richard M. Stallman and Roland H. Pesch.  The same text is available online
861f93
+as the @code{gdb} entry in the @code{info} program.
861f93
+@end ifset
861f93
+@c man end
861f93
+
861f93
+@c man begin OPTIONS gdb
861f93
+Any arguments other than options specify an executable
861f93
+file and core file (or process ID); that is, the first argument
861f93
+encountered with no
861f93
+associated option flag is equivalent to a @option{-se} option, and the second,
861f93
+if any, is equivalent to a @option{-c} option if it's the name of a file.
861f93
+Many options have
861f93
+both long and short forms; both are shown here.  The long forms are also
861f93
+recognized if you truncate them, so long as enough of the option is
861f93
+present to be unambiguous.  (If you prefer, you can flag option
861f93
+arguments with @option{+} rather than @option{-}, though we illustrate the
861f93
+more usual convention.)
861f93
+
861f93
+All the options and command line arguments you give are processed
861f93
+in sequential order.  The order makes a difference when the @option{-x}
861f93
+option is used.
861f93
+
861f93
+@table @env
861f93
+@item -help
861f93
+@itemx -h
861f93
+List all options, with brief explanations.
861f93
+
861f93
+@item -symbols=@var{file}
861f93
+@itemx -s @var{file}
861f93
+Read symbol table from file @var{file}.
861f93
+
861f93
+@item -write
861f93
+Enable writing into executable and core files.
861f93
+
861f93
+@item -exec=@var{file}
861f93
+@itemx -e @var{file}
861f93
+Use file @var{file} as the executable file to execute when
861f93
+appropriate, and for examining pure data in conjunction with a core
861f93
+dump.
861f93
+
861f93
+@item -se=@var{file}
861f93
+Read symbol table from file @var{file} and use it as the executable
861f93
+file.
861f93
+
861f93
+@item -core=@var{file}
861f93
+@itemx -c @var{file}
861f93
+Use file @var{file} as a core dump to examine.
861f93
+
861f93
+@item -command=@var{file}
861f93
+@itemx -x @var{file}
861f93
+Execute @value{GDBN} commands from file @var{file}.
861f93
+
861f93
+@item -ex @var{command}
861f93
+Execute given @value{GDBN} @var{command}.
861f93
+
861f93
+@item -directory=@var{directory}
861f93
+@itemx -d @var{directory}
861f93
+Add @var{directory} to the path to search for source files.
861f93
+
861f93
+@item -nh
861f93
+Do not execute commands from @file{~/.gdbinit}.
861f93
+
861f93
+@item -nx
861f93
+@itemx -n
861f93
+Do not execute commands from any @file{.gdbinit} initialization files.
861f93
+
861f93
+@item -quiet
861f93
+@itemx -q
861f93
+``Quiet''.  Do not print the introductory and copyright messages.  These
861f93
+messages are also suppressed in batch mode.
861f93
+
861f93
+@item -batch
861f93
+Run in batch mode.  Exit with status @code{0} after processing all the command
861f93
+files specified with @option{-x} (and @file{.gdbinit}, if not inhibited).
861f93
+Exit with nonzero status if an error occurs in executing the @value{GDBN}
861f93
+commands in the command files.
861f93
+
861f93
+Batch mode may be useful for running @value{GDBN} as a filter, for example to
861f93
+download and run a program on another computer; in order to make this
861f93
+more useful, the message
861f93
+
861f93
+@smallexample
861f93
+Program exited normally.
861f93
+@end smallexample
861f93
+
861f93
+@noindent
861f93
+(which is ordinarily issued whenever a program running under @value{GDBN} control
861f93
+terminates) is not issued when running in batch mode.
861f93
+
861f93
+@item -cd=@var{directory}
861f93
+Run @value{GDBN} using @var{directory} as its working directory,
861f93
+instead of the current directory.
861f93
+
861f93
+@item -fullname
861f93
+@itemx -f
861f93
+Emacs sets this option when it runs @value{GDBN} as a subprocess.  It tells
861f93
+@value{GDBN} to output the full file name and line number in a standard,
861f93
+recognizable fashion each time a stack frame is displayed (which
861f93
+includes each time the program stops).  This recognizable format looks
861f93
+like two @samp{\032} characters, followed by the file name, line number
861f93
+and character position separated by colons, and a newline.  The
861f93
+Emacs-to-@value{GDBN} interface program uses the two @samp{\032}
861f93
+characters as a signal to display the source code for the frame.
861f93
+
861f93
+@item -b @var{bps}
861f93
+Set the line speed (baud rate or bits per second) of any serial
861f93
+interface used by @value{GDBN} for remote debugging.
861f93
+
861f93
+@item -tty=@var{device}
861f93
+Run using @var{device} for your program's standard input and output.
861f93
+@end table
861f93
+@c man end
861f93
+
861f93
+@c man begin SEEALSO gdb
861f93
+@ifset man
861f93
+The full documentation for @value{GDBN} is maintained as a Texinfo manual.
861f93
+If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
861f93
+documentation are properly installed at your site, the command
861f93
+
861f93
+@smallexample
861f93
+info gdb
861f93
+@end smallexample
861f93
+
861f93
+@noindent
861f93
+should give you access to the complete manual.
861f93
+
861f93
+@cite{Using GDB: A Guide to the GNU Source-Level Debugger},
861f93
+Richard M. Stallman and Roland H. Pesch, July 1991.
861f93
+@end ifset
861f93
+@c man end
861f93
+
861f93
+@node gdbserver man
861f93
+@heading gdbserver man
861f93
+
861f93
+@c man title gdbserver Remote Server for the GNU Debugger
861f93
+@format
861f93
+@c man begin SYNOPSIS gdbserver
861f93
+gdbserver @var{tty} @var{prog} [@var{args}@dots{}]
861f93
+
861f93
+gdbserver @var{tty} --attach @var{PID}
861f93
+@c man end
861f93
+@end format
861f93
+
861f93
+@c man begin DESCRIPTION gdbserver
861f93
+@command{gdbserver} is a program that allows you to run @value{GDBN} on a different machine
861f93
+than the one which is running the program being debugged.
861f93
+
861f93
+@ifclear man
861f93
+@subheading Usage (server (target) side)
861f93
+@end ifclear
861f93
+@ifset man
861f93
+Usage (server (target) side):
861f93
+@end ifset
861f93
+
861f93
+First, you need to have a copy of the program you want to debug put onto
861f93
+the target system.  The program can be stripped to save space if needed, as
861f93
+@command{gdbserver} doesn't care about symbols.  All symbol handling is taken care of by
861f93
+the @value{GDBN} running on the host system.
861f93
+
861f93
+To use the server, you log on to the target system, and run the @command{gdbserver}
861f93
+program.  You must tell it (a) how to communicate with @value{GDBN}, (b) the name of
861f93
+your program, and (c) its arguments.  The general syntax is:
861f93
+
861f93
+@smallexample
861f93
+target> gdbserver @var{comm} @var{program} [@var{args} ...]
861f93
+@end smallexample
861f93
+
861f93
+For example, using a serial port, you might say:
861f93
+
861f93
+@smallexample
861f93
+@ifset man
861f93
+@c @file would wrap it as F</dev/com1>.
861f93
+target> gdbserver /dev/com1 emacs foo.txt
861f93
+@end ifset
861f93
+@ifclear man
861f93
+target> gdbserver @file{/dev/com1} emacs foo.txt
861f93
+@end ifclear
861f93
+@end smallexample
861f93
+
861f93
+This tells @command{gdbserver} to debug emacs with an argument of foo.txt, and
861f93
+to communicate with @value{GDBN} via @file{/dev/com1}.  @command{gdbserver} now
861f93
+waits patiently for the host @value{GDBN} to communicate with it.
861f93
+
861f93
+To use a TCP connection, you could say:
861f93
+
861f93
+@smallexample
861f93
+target> gdbserver host:2345 emacs foo.txt
861f93
+@end smallexample
861f93
+
861f93
+This says pretty much the same thing as the last example, except that we are
861f93
+going to communicate with the @code{host} @value{GDBN} via TCP.  The @code{host:2345} argument means
861f93
+that we are expecting to see a TCP connection from @code{host} to local TCP port
861f93
+2345.  (Currently, the @code{host} part is ignored.)  You can choose any number you
861f93
+want for the port number as long as it does not conflict with any existing TCP
861f93
+ports on the target system.  This same port number must be used in the host
861f93
+@value{GDBN}s @code{target remote} command, which will be described shortly.  Note that if
861f93
+you chose a port number that conflicts with another service, @command{gdbserver} will
861f93
+print an error message and exit.
861f93
+
861f93
+On some targets, @command{gdbserver} can also attach to running programs.
861f93
+This is accomplished via the @option{--attach} argument.  The syntax is:
861f93
+
861f93
+@smallexample
861f93
+target> gdbserver @var{comm} --attach @var{pid}
861f93
+@end smallexample
861f93
+
861f93
+@var{pid} is the process ID of a currently running process.  It isn't
861f93
+necessary to point @command{gdbserver} at a binary for the running process.
861f93
+
861f93
+@ifclear man
861f93
+@subheading Usage (host side)
861f93
+@end ifclear
861f93
+@ifset man
861f93
+Usage (host side):
861f93
+@end ifset
861f93
+
861f93
+You need an unstripped copy of the target program on your host system, since
861f93
+@value{GDBN} needs to examine it's symbol tables and such.  Start up @value{GDBN} as you normally
861f93
+would, with the target program as the first argument.  (You may need to use the
861f93
+@option{--baud} option if the serial line is running at anything except 9600 baud.)
861f93
+That is @code{gdb TARGET-PROG}, or @code{gdb --baud BAUD TARGET-PROG}.  After that, the only
861f93
+new command you need to know about is @code{target remote}.  It's argument is either
861f93
+a device name (usually a serial device, like @file{/dev/ttyb}), or a @code{HOST:PORT}
861f93
+descriptor.  For example:
861f93
+
861f93
+@smallexample
861f93
+@ifset man
861f93
+@c @file would wrap it as F</dev/ttyb>.
861f93
+(gdb) target remote /dev/ttyb
861f93
+@end ifset
861f93
+@ifclear man
861f93
+(gdb) target remote @file{/dev/ttyb}
861f93
+@end ifclear
861f93
+@end smallexample
861f93
+
861f93
+@noindent
861f93
+communicates with the server via serial line @file{/dev/ttyb}, and:
861f93
+
861f93
+@smallexample
861f93
+(gdb) target remote the-target:2345
861f93
+@end smallexample
861f93
+
861f93
+@noindent
861f93
+communicates via a TCP connection to port 2345 on host `the-target', where
861f93
+you previously started up @command{gdbserver} with the same port number.  Note that for
861f93
+TCP connections, you must start up @command{gdbserver} prior to using the `target remote'
861f93
+command, otherwise you may get an error that looks something like
861f93
+`Connection refused'.
861f93
+@c man end
861f93
+
861f93
+@c man begin OPTIONS gdbserver
861f93
+You have to supply the name of the program to debug
861f93
+and the tty to communicate on; the remote @value{GDBN} will do everything else.
861f93
+Any remaining arguments will be passed to the program verbatim.
861f93
+@c man end
861f93
+
861f93
+@c man begin SEEALSO gdbserver
861f93
+@ifset man
861f93
+The full documentation for @value{GDBN} is maintained as a Texinfo manual.
861f93
+If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
861f93
+documentation are properly installed at your site, the command
861f93
+
861f93
+@smallexample
861f93
+info gdb
861f93
+@end smallexample
861f93
+
861f93
+should give you access to the complete manual.
861f93
+
861f93
+@cite{Using GDB: A Guide to the GNU Source-Level Debugger},
861f93
+Richard M. Stallman and Roland H. Pesch, July 1991.
861f93
+@end ifset
861f93
+@c man end
861f93
+
861f93
+@node gdbinit man
861f93
+@heading gdbinit
861f93
+
861f93
+@c man title gdbinit GDB initialization scripts
861f93
+
861f93
+@format
861f93
+@c man begin SYNOPSIS gdbinit
861f93
+@ifset SYSTEM_GDBINIT
861f93
+@value{SYSTEM_GDBINIT}
861f93
+@end ifset
861f93
+
861f93
+~/.gdbinit
861f93
+
861f93
+./.gdbinit
861f93
+@c man end
861f93
+@end format
861f93
+
861f93
+@c man begin DESCRIPTION gdbinit
861f93
+These files contain @value{GDBN} commands to automatically execute during
861f93
+@value{GDBN} startup.  The lines of contents are canned sequences of commands,
861f93
+described in
861f93
+@ifset man
861f93
+the @value{GDBN} manual in node @code{Sequences}
861f93
+-- shell command @code{info -f gdb -n Sequences}.
861f93
+@end ifset
861f93
+@ifclear man
861f93
+@ref{Sequences}.
861f93
+@end ifclear
861f93
+
861f93
+Please read more in
861f93
+@ifset man
861f93
+the @value{GDBN} manual in node @code{Startup}
861f93
+-- shell command @code{info -f gdb -n Startup}.
861f93
+@end ifset
861f93
+@ifclear man
861f93
+@ref{Startup}.
861f93
+@end ifclear
861f93
+
861f93
+@table @env
861f93
+@ifset SYSTEM_GDBINIT
861f93
+@item @value{SYSTEM_GDBINIT}
861f93
+@end ifset
861f93
+@ifclear SYSTEM_GDBINIT
861f93
+@item (not enabled with @code{--with-system-gdbinit} during compilation)
861f93
+@end ifclear
861f93
+System-wide initialization file.  It is executed unless user specified
861f93
+@value{GDBN} option @code{-nx} or @code{-n}.
861f93
+See more in
861f93
+@ifset man
861f93
+the @value{GDBN} manual in node @code{System-wide configuration}
861f93
+-- shell command @code{info -f gdb -n 'System-wide configuration'}.
861f93
+@end ifset
861f93
+@ifclear man
861f93
+@ref{System-wide configuration}.
861f93
+@end ifclear
861f93
+
861f93
+@item ~/.gdbinit
861f93
+User initialization file.  It is executed unless user specified
861f93
+@value{GDBN} options @code{-nx}, @code{-n} or @code{-nh}.
861f93
+
861f93
+@item ./.gdbinit
861f93
+Initialization file for current directory.  It may need to be enabled with
861f93
+@value{GDBN} security command @code{set auto-load local-gdbinit}.
861f93
+See more in
861f93
+@ifset man
861f93
+the @value{GDBN} manual in node @code{Init File in the Current Directory}
861f93
+-- shell command @code{info -f gdb -n 'Init File in the Current Directory'}.
861f93
+@end ifset
861f93
+@ifclear man
861f93
+@ref{Init File in the Current Directory}.
861f93
+@end ifclear
861f93
+@end table
861f93
+@c man end
861f93
+
861f93
+@c man begin SEEALSO gdbinit
861f93
+@ifset man
861f93
+gdb(1), @code{info -f gdb -n Startup}
861f93
+
861f93
+The full documentation for @value{GDBN} is maintained as a Texinfo manual.
861f93
+If the @code{info} and @code{gdb} programs and @value{GDBN}'s Texinfo
861f93
+documentation are properly installed at your site, the command
861f93
+
861f93
+@smallexample
861f93
+info gdb
861f93
+@end smallexample
861f93
+
861f93
+should give you access to the complete manual.
861f93
+
861f93
+@cite{Using GDB: A Guide to the GNU Source-Level Debugger},
861f93
+Richard M. Stallman and Roland H. Pesch, July 1991.
861f93
+@end ifset
861f93
+@c man end
861f93
+
861f93
 @include gpl.texi
861f93
 
861f93
 @node GNU Free Documentation License
861f93
### src/gdb/gdbserver/ChangeLog	2013/03/22 14:52:26	1.702
861f93
### src/gdb/gdbserver/ChangeLog	2013/04/05 20:01:33	1.703
861f93
## -1,3 +1,10 @@
861f93
+2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+
861f93
+	Convert man pages to texinfo, new gdbinit.5 texinfo page.
861f93
+	* Makefile.in (install-only): Remove $(man1dir) and gdbserver.1
861f93
+	installation.
861f93
+	* gdbserver.1: Remove.
861f93
+
861f93
 2013-03-22  Pedro Alves  <palves@redhat.com>
861f93
 
861f93
 	* linux-low.c (handle_extended_wait): Don't call
861f93
--- src/gdb/gdbserver/Makefile.in	2013/03/15 17:30:27	1.145
861f93
+++ src/gdb/gdbserver/Makefile.in	2013/04/05 20:01:33	1.146
861f93
@@ -252,8 +252,6 @@
861f93
 	fi; \
861f93
 	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
861f93
 	$(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \
861f93
-	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(man1dir); \
861f93
-	$(INSTALL_DATA) $(srcdir)/gdbserver.1 $(DESTDIR)$(man1dir)/$$n.1
861f93
 	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
861f93
 
861f93
 uninstall: force
861f93
861f93
861f93
861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00057.html
861f93
861f93
### src/gdb/doc/ChangeLog	2013/04/05 20:01:33	1.1433
861f93
### src/gdb/doc/ChangeLog	2013/04/05 20:02:58	1.1434
861f93
## -1,5 +1,10 @@
861f93
 2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 
861f93
+	* gdb.texinfo (gdb man): Mention option -p.  Include Fortran to
861f93
+	the list of supported languages.
861f93
+
861f93
+2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+
861f93
 	Convert man pages to texinfo, new gdbinit.5 texinfo page.
861f93
 	* Makefile.in (mandir, man1dir, man5dir, SYSTEM_GDBINIT, MANCONF,
861f93
 	(TEXI2POD, POD2MAN1, POD2MAN5, MAN1S, MAN5S, MANS, man): New.
861f93
--- src/gdb/doc/gdb.texinfo	2013/04/05 20:01:33	1.1070
861f93
+++ src/gdb/doc/gdb.texinfo	2013/04/05 20:02:58	1.1071
861f93
@@ -41623,8 +41623,9 @@
861f93
 [@option{-b}@w{ }@var{bps}]
861f93
     [@option{-tty=}@var{dev}] [@option{-s} @var{symfile}]
861f93
 [@option{-e}@w{ }@var{prog}] [@option{-se}@w{ }@var{prog}]
861f93
-[@option{-c}@w{ }@var{core}] [@option{-x}@w{ }@var{cmds}]
861f93
-    [@option{-d}@w{ }@var{dir}] [@var{prog}|@var{core}|@var{procID}]
861f93
+[@option{-c}@w{ }@var{core}] [@option{-p}@w{ }@var{procID}]
861f93
+    [@option{-x}@w{ }@var{cmds}] [@option{-d}@w{ }@var{dir}]
861f93
+[@var{prog}|@var{prog} @var{procID}|@var{prog} @var{core}]
861f93
 @c man end
861f93
 
861f93
 @c man begin DESCRIPTION gdb
861f93
@@ -41650,8 +41651,8 @@
861f93
 effects of one bug and go on to learn about another.
861f93
 @end itemize
861f93
 
861f93
-You can use @value{GDBN} to debug programs written in C, C@t{++}, and Modula-2.
861f93
-Fortran support will be added when a GNU Fortran compiler is ready.
861f93
+You can use @value{GDBN} to debug programs written in C, C@t{++}, Fortran and
861f93
+Modula-2.
861f93
 
861f93
 @value{GDBN} is invoked with the shell command @code{gdb}.  Once started, it reads
861f93
 commands from the terminal until you tell it to exit with the @value{GDBN}
861f93
@@ -41677,11 +41678,13 @@
861f93
 
861f93
 @smallexample
861f93
 gdb program 1234
861f93
+gdb -p 1234
861f93
 @end smallexample
861f93
 
861f93
 @noindent
861f93
 would attach @value{GDBN} to process @code{1234} (unless you also have a file
861f93
 named @file{1234}; @value{GDBN} does check for a core file first).
861f93
+With option @option{-p} you can omit the @var{program} filename.
861f93
 
861f93
 Here are some of the most frequently needed @value{GDBN} commands:
861f93
 
861f93
861f93
861f93
861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00064.html
861f93
861f93
### src/gdb/doc/ChangeLog	2013/04/05 20:02:58	1.1434
861f93
### src/gdb/doc/ChangeLog	2013/04/06 08:58:53	1.1435
861f93
## -1,3 +1,11 @@
861f93
+2013-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+	    Eli Zaretskii  <eliz@gnu.org>
861f93
+
861f93
+	* gdb.texinfo (gdbserver man): Rename tty to comm.  Swap --attach
861f93
+	parameters order.  Remove "On some targets" for --attach.  Document the
861f93
+	--multi parameter and extended-remote command.  Document all the
861f93
+	options.
861f93
+
861f93
 2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 
861f93
 	* gdb.texinfo (gdb man): Mention option -p.  Include Fortran to
861f93
--- src/gdb/doc/gdb.texinfo	2013/04/05 20:02:58	1.1071
861f93
+++ src/gdb/doc/gdb.texinfo	2013/04/06 08:58:53	1.1072
861f93
@@ -41867,9 +41867,11 @@
861f93
 @c man title gdbserver Remote Server for the GNU Debugger
861f93
 @format
861f93
 @c man begin SYNOPSIS gdbserver
861f93
-gdbserver @var{tty} @var{prog} [@var{args}@dots{}]
861f93
+gdbserver @var{comm} @var{prog} [@var{args}@dots{}]
861f93
 
861f93
-gdbserver @var{tty} --attach @var{PID}
861f93
+gdbserver --attach @var{comm} @var{pid}
861f93
+
861f93
+gdbserver --multi @var{comm}
861f93
 @c man end
861f93
 @end format
861f93
 
861f93
@@ -41929,16 +41931,25 @@
861f93
 you chose a port number that conflicts with another service, @command{gdbserver} will
861f93
 print an error message and exit.
861f93
 
861f93
-On some targets, @command{gdbserver} can also attach to running programs.
861f93
+@command{gdbserver} can also attach to running programs.
861f93
 This is accomplished via the @option{--attach} argument.  The syntax is:
861f93
 
861f93
 @smallexample
861f93
-target> gdbserver @var{comm} --attach @var{pid}
861f93
+target> gdbserver --attach @var{comm} @var{pid}
861f93
 @end smallexample
861f93
 
861f93
 @var{pid} is the process ID of a currently running process.  It isn't
861f93
 necessary to point @command{gdbserver} at a binary for the running process.
861f93
 
861f93
+To start @code{gdbserver} without supplying an initial command to run
861f93
+or process ID to attach, use the @option{--multi} command line option.
861f93
+In such case you should connect using @kbd{target extended-remote} to start
861f93
+the program you want to debug.
861f93
+
861f93
+@smallexample
861f93
+target> gdbserver --multi @var{comm}
861f93
+@end smallexample
861f93
+
861f93
 @ifclear man
861f93
 @subheading Usage (host side)
861f93
 @end ifclear
861f93
@@ -41951,7 +41962,8 @@
861f93
 would, with the target program as the first argument.  (You may need to use the
861f93
 @option{--baud} option if the serial line is running at anything except 9600 baud.)
861f93
 That is @code{gdb TARGET-PROG}, or @code{gdb --baud BAUD TARGET-PROG}.  After that, the only
861f93
-new command you need to know about is @code{target remote}.  It's argument is either
861f93
+new command you need to know about is @code{target remote}
861f93
+(or @code{target extended-remote}).  Its argument is either
861f93
 a device name (usually a serial device, like @file{/dev/ttyb}), or a @code{HOST:PORT}
861f93
 descriptor.  For example:
861f93
 
861f93
@@ -41978,12 +41990,131 @@
861f93
 TCP connections, you must start up @command{gdbserver} prior to using the `target remote'
861f93
 command, otherwise you may get an error that looks something like
861f93
 `Connection refused'.
861f93
+
861f93
+@command{gdbserver} can also debug multiple inferiors at once,
861f93
+described in
861f93
+@ifset man
861f93
+the @value{GDBN} manual in node @code{Inferiors and Programs}
861f93
+-- shell command @code{info -f gdb -n 'Inferiors and Programs'}.
861f93
+@end ifset
861f93
+@ifclear man
861f93
+@ref{Inferiors and Programs}.
861f93
+@end ifclear
861f93
+In such case use the @code{extended-remote} @value{GDBN} command variant:
861f93
+
861f93
+@smallexample
861f93
+(gdb) target extended-remote the-target:2345
861f93
+@end smallexample
861f93
+
861f93
+The @command{gdbserver} option @option{--multi} may or may not be used in such
861f93
+case.
861f93
 @c man end
861f93
 
861f93
 @c man begin OPTIONS gdbserver
861f93
-You have to supply the name of the program to debug
861f93
-and the tty to communicate on; the remote @value{GDBN} will do everything else.
861f93
-Any remaining arguments will be passed to the program verbatim.
861f93
+There are three different modes for invoking @command{gdbserver}:
861f93
+
861f93
+@itemize @bullet
861f93
+
861f93
+@item
861f93
+Debug a specific program specified by its program name:
861f93
+
861f93
+@smallexample
861f93
+gdbserver @var{comm} @var{prog} [@var{args}@dots{}]
861f93
+@end smallexample
861f93
+
861f93
+The @var{comm} parameter specifies how should the server communicate
861f93
+with @value{GDBN}; it is either a device name (to use a serial line),
861f93
+a TCP port number (@code{:1234}), or @code{-} or @code{stdio} to use
861f93
+stdin/stdout of @code{gdbserver}.  Specify the name of the program to
861f93
+debug in @var{prog}.  Any remaining arguments will be passed to the
861f93
+program verbatim.  When the program exits, @value{GDBN} will close the
861f93
+connection, and @code{gdbserver} will exit.
861f93
+
861f93
+@item
861f93
+Debug a specific program by specifying the process ID of a running
861f93
+program:
861f93
+
861f93
+@smallexample
861f93
+gdbserver --attach @var{comm} @var{pid}
861f93
+@end smallexample
861f93
+
861f93
+The @var{comm} parameter is as described above.  Supply the process ID
861f93
+of a running program in @var{pid}; @value{GDBN} will do everything
861f93
+else.  Like with the previous mode, when the process @var{pid} exits,
861f93
+@value{GDBN} will close the connection, and @code{gdbserver} will exit.
861f93
+
861f93
+@item
861f93
+Multi-process mode -- debug more than one program/process:
861f93
+
861f93
+@smallexample
861f93
+gdbserver --multi @var{comm}
861f93
+@end smallexample
861f93
+
861f93
+In this mode, @value{GDBN} can instruct @command{gdbserver} which
861f93
+command(s) to run.  Unlike the other 2 modes, @value{GDBN} will not
861f93
+close the connection when a process being debugged exits, so you can
861f93
+debug several processes in the same session.
861f93
+@end itemize
861f93
+
861f93
+In each of the modes you may specify these options:
861f93
+
861f93
+@table @env
861f93
+
861f93
+@item --help
861f93
+List all options, with brief explanations.
861f93
+
861f93
+@item --version
861f93
+This option causes @command{gdbserver} to print its version number and exit.
861f93
+
861f93
+@item --attach
861f93
+@command{gdbserver} will attach to a running program.  The syntax is:
861f93
+
861f93
+@smallexample
861f93
+target> gdbserver --attach @var{comm} @var{pid}
861f93
+@end smallexample
861f93
+
861f93
+@var{pid} is the process ID of a currently running process.  It isn't
861f93
+necessary to point @command{gdbserver} at a binary for the running process.
861f93
+
861f93
+@item --multi
861f93
+To start @code{gdbserver} without supplying an initial command to run
861f93
+or process ID to attach, use this command line option.
861f93
+Then you can connect using @kbd{target extended-remote} and start
861f93
+the program you want to debug.  The syntax is:
861f93
+
861f93
+@smallexample
861f93
+target> gdbserver --multi @var{comm}
861f93
+@end smallexample
861f93
+
861f93
+@item --debug
861f93
+Instruct @code{gdbserver} to display extra status information about the debugging
861f93
+process.
861f93
+This option is intended for @code{gdbserver} development and for bug reports to
861f93
+the developers.
861f93
+
861f93
+@item --remote-debug
861f93
+Instruct @code{gdbserver} to display remote protocol debug output.
861f93
+This option is intended for @code{gdbserver} development and for bug reports to
861f93
+the developers.
861f93
+
861f93
+@item --wrapper
861f93
+Specify a wrapper to launch programs
861f93
+for debugging.  The option should be followed by the name of the
861f93
+wrapper, then any command-line arguments to pass to the wrapper, then
861f93
+@kbd{--} indicating the end of the wrapper arguments.
861f93
+
861f93
+@item --once
861f93
+By default, @command{gdbserver} keeps the listening TCP port open, so that
861f93
+additional connections are possible.  However, if you start @code{gdbserver}
861f93
+with the @option{--once} option, it will stop listening for any further
861f93
+connection attempts after connecting to the first @value{GDBN} session.
861f93
+
861f93
+@c --disable-packet is not documented for users.
861f93
+
861f93
+@c --disable-randomization and --no-disable-randomization are superseded by
861f93
+@c QDisableRandomization.
861f93
+
861f93
+@end table
861f93
 @c man end
861f93
 
861f93
 @c man begin SEEALSO gdbserver
861f93
861f93
861f93
861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00065.html
861f93
861f93
### src/gdb/doc/ChangeLog	2013/04/06 08:58:53	1.1435
861f93
### src/gdb/doc/ChangeLog	2013/04/06 15:52:06	1.1436
861f93
## -1,4 +1,8 @@
861f93
 2013-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+
861f93
+	* Makefile.in (POD2MAN1, POD2MAN5): Replace $(VERSION) by ../version.in.
861f93
+
861f93
+2013-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 	    Eli Zaretskii  <eliz@gnu.org>
861f93
 
861f93
 	* gdb.texinfo (gdbserver man): Rename tty to comm.  Swap --attach
861f93
--- src/gdb/doc/Makefile.in	2013/04/05 20:01:33	1.58
861f93
+++ src/gdb/doc/Makefile.in	2013/04/06 15:52:06	1.59
861f93
@@ -172,9 +172,9 @@
861f93
 		$(MAKEINFOFLAGS) $(MAKEINFO_EXTRA_FLAGS)
861f93
 
861f93
 POD2MAN1 = pod2man --center="GNU Development Tools" \
861f93
-		   --release="gdb-$(VERSION)" --section=1
861f93
+		   --release="gdb-`sed q $(srcdir)/../version.in`" --section=1
861f93
 POD2MAN5 = pod2man --center="GNU Development Tools" \
861f93
-		   --release="gdb-$(VERSION)" --section=5
861f93
+		   --release="gdb-`sed q $(srcdir)/../version.in`" --section=5
861f93
 
861f93
 # List of man pages generated from gdb.texi
861f93
 MAN1S = gdb.1 gdbserver.1
861f93
861f93
861f93
861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00068.html
861f93
861f93
### src/gdb/gdbserver/ChangeLog	2013/04/05 20:01:33	1.703
861f93
### src/gdb/gdbserver/ChangeLog	2013/04/07 05:53:21	1.704
861f93
## -1,3 +1,7 @@
861f93
+2013-04-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
+
861f93
+	* Makefile.in (install-only): Fix make install regression.
861f93
+
861f93
 2013-04-05  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 
861f93
 	Convert man pages to texinfo, new gdbinit.5 texinfo page.
861f93
--- src/gdb/gdbserver/Makefile.in	2013/04/05 20:01:33	1.146
861f93
+++ src/gdb/gdbserver/Makefile.in	2013/04/07 05:53:22	1.147
861f93
@@ -251,7 +251,7 @@
861f93
 		$(INSTALL_PROGRAM) $(IPA_LIB) $(DESTDIR)$(libdir)/$(IPA_LIB); \
861f93
 	fi; \
861f93
 	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \
861f93
-	$(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT); \
861f93
+	$(INSTALL_PROGRAM) gdbserver$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
861f93
 	@$(MAKE) $(FLAGS_TO_PASS) DO=$@ "DODIRS=$(SUBDIRS)" subdir_do
861f93
 
861f93
 uninstall: force
861f93
861f93
861f93
861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00069.html
861f93
861f93
### src/gdb/doc/ChangeLog	2013/04/06 15:52:06	1.1436
861f93
### src/gdb/doc/ChangeLog	2013/04/07 06:04:58	1.1437
861f93
## -2,6 +2,9 @@
861f93
 
861f93
 	* Makefile.in (POD2MAN1, POD2MAN5): Replace $(VERSION) by ../version.in.
861f93
 
861f93
+	* Makefile.in (install-man1, install-man5, uninstall-man1)
861f93
+	(uninstall-man5): Replace $(MANS) by $(MAN1S) and $(MAN5S) respectively.
861f93
+
861f93
 2013-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 	    Eli Zaretskii  <eliz@gnu.org>
861f93
 
861f93
--- src/gdb/doc/Makefile.in	2013/04/06 15:52:06	1.59
861f93
+++ src/gdb/doc/Makefile.in	2013/04/07 06:04:58	1.60
861f93
@@ -268,7 +268,7 @@
861f93
 
861f93
 install-man1: $(MAN1S)
861f93
 	test -z "$(man1dir)" || $(mkinstalldirs) "$(DESTDIR)$(man1dir)"
861f93
-	@list='$(MANS)'; for p in $$list; do \
861f93
+	@list='$(MAN1S)'; for p in $$list; do \
861f93
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
861f93
 	  f=`echo $$p | sed -e 's|^.*/||'`; \
861f93
 	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man1dir)/$$f'"; \
861f93
@@ -277,7 +277,7 @@
861f93
 
861f93
 install-man5: $(MAN5S)
861f93
 	test -z "$(man5dir)" || $(mkinstalldirs) "$(DESTDIR)$(man5dir)"
861f93
-	@list='$(MANS)'; for p in $$list; do \
861f93
+	@list='$(MAN5S)'; for p in $$list; do \
861f93
 	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
861f93
 	  f=`echo $$p | sed -e 's|^.*/||'`; \
861f93
 	  echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(man5dir)/$$f'"; \
861f93
@@ -288,7 +288,7 @@
861f93
 
861f93
 uninstall-man1:
861f93
 	@test -n "$(man1dir)" || exit 0; \
861f93
-	files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \
861f93
+	files=`{ l2='$(MAN1S)'; for i in $$l2; do echo "$$i"; done | \
861f93
 	  sed -n '/\.1[a-z]*$$/p'; \
861f93
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
861f93
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
861f93
@@ -298,7 +298,7 @@
861f93
 
861f93
 uninstall-man5:
861f93
 	@test -n "$(man5dir)" || exit 0; \
861f93
-	files=`{ l2='$(MANS)'; for i in $$l2; do echo "$$i"; done | \
861f93
+	files=`{ l2='$(MAN5S)'; for i in $$l2; do echo "$$i"; done | \
861f93
 	  sed -n '/\.5[a-z]*$$/p'; \
861f93
 	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^5][0-9a-z]*$$,5,;x' \
861f93
 	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
861f93
861f93
861f93
861f93
http://sourceware.org/ml/gdb-cvs/2013-04/msg00070.html
861f93
861f93
### src/gdb/doc/ChangeLog	2013/04/07 06:04:58	1.1437
861f93
### src/gdb/doc/ChangeLog	2013/04/07 06:20:19	1.1438
861f93
## -5,6 +5,8 @@
861f93
 	* Makefile.in (install-man1, install-man5, uninstall-man1)
861f93
 	(uninstall-man5): Replace $(MANS) by $(MAN1S) and $(MAN5S) respectively.
861f93
 
861f93
+	* Makefile.in (gdb.1, gdbserver.1, gdbinit.5): Use $(srcdir).
861f93
+
861f93
 2013-04-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
861f93
 	    Eli Zaretskii  <eliz@gnu.org>
861f93
 
861f93
--- src/gdb/doc/Makefile.in	2013/04/07 06:04:58	1.60
861f93
+++ src/gdb/doc/Makefile.in	2013/04/07 06:20:19	1.61
861f93
@@ -593,21 +593,21 @@
861f93
 # Man pages
861f93
 gdb.1: $(GDB_DOC_FILES)
861f93
 	touch $@
861f93
-	-$(TEXI2POD) $(MANCONF) -Dgdb < gdb.texinfo > gdb.pod
861f93
+	-$(TEXI2POD) $(MANCONF) -Dgdb < $(srcdir)/gdb.texinfo > gdb.pod
861f93
 	-($(POD2MAN1) gdb.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
861f93
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
861f93
 	rm -f gdb.pod
861f93
 
861f93
 gdbserver.1: $(GDB_DOC_FILES)
861f93
 	touch $@
861f93
-	-$(TEXI2POD) $(MANCONF) -Dgdbserver < gdb.texinfo > gdbserver.pod
861f93
+	-$(TEXI2POD) $(MANCONF) -Dgdbserver < $(srcdir)/gdb.texinfo > gdbserver.pod
861f93
 	-($(POD2MAN1) gdbserver.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
861f93
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
861f93
 	rm -f gdbserver.pod
861f93
 
861f93
 gdbinit.5: $(GDB_DOC_FILES)
861f93
 	touch $@
861f93
-	-$(TEXI2POD) $(MANCONF) -Dgdbinit < gdb.texinfo > gdbinit.pod
861f93
+	-$(TEXI2POD) $(MANCONF) -Dgdbinit < $(srcdir)/gdb.texinfo > gdbinit.pod
861f93
 	-($(POD2MAN5) gdbinit.pod | sed -e '/^.if n .na/d' > $@.T$$$$ && \
861f93
 		mv -f $@.T$$$$ $@) || (rm -f $@.T$$$$ && exit 1)
861f93
 	rm -f gdbinit.pod
861f93
861f93
861f93
861f93
https://bugzilla.redhat.com/show_bug.cgi?id=967915
861f93
http://sourceware.org/ml/gdb-cvs/2013-05/msg00146.html
861f93
861f93
### src/gdb/ChangeLog	2013/05/17 18:09:05	1.15569
861f93
### src/gdb/ChangeLog	2013/05/17 23:05:00	1.15570
861f93
## -1,3 +1,9 @@
861f93
+2013-05-17  Edjunior Machado  <emachado@linux.vnet.ibm.com>
861f93
+
861f93
+	* ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): Check if the
861f93
+	region is ok for a hardware watchpoint using the new ptrace interface
861f93
+	on Power servers.
861f93
+
861f93
 2013-05-17  Doug Evans  <dje@google.com>
861f93
 
861f93
 	* NEWS: Mention new maintenance commands check-symtabs, and
861f93
--- src/gdb/ppc-linux-nat.c	2013/05/07 07:43:33	1.119
861f93
+++ src/gdb/ppc-linux-nat.c	2013/05/17 23:05:00	1.120
861f93
@@ -1503,16 +1503,19 @@
861f93
      to determine the hardcoded watchable region for watchpoints.  */
861f93
   if (have_ptrace_booke_interface ())
861f93
     {
861f93
-      /* DAC-based processors (i.e., embedded processors), like the PowerPC 440
861f93
-	 have ranged watchpoints and can watch any access within an arbitrary
861f93
-	 memory region.  This is useful to watch arrays and structs, for
861f93
-	 instance.  It takes two hardware watchpoints though.  */
861f93
+      /* Embedded DAC-based processors, like the PowerPC 440 have ranged
861f93
+	 watchpoints and can watch any access within an arbitrary memory
861f93
+	 region. This is useful to watch arrays and structs, for instance.  It
861f93
+         takes two hardware watchpoints though.  */
861f93
       if (len > 1
861f93
-	  && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE)
861f93
+	  && booke_debug_info.features & PPC_DEBUG_FEATURE_DATA_BP_RANGE
861f93
+	  && ppc_linux_get_hwcap () & PPC_FEATURE_BOOKE)
861f93
 	return 2;
861f93
-      else if (booke_debug_info.data_bp_alignment
861f93
-	       && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1))
861f93
-		   + booke_debug_info.data_bp_alignment))
861f93
+      /* Server processors provide one hardware watchpoint and addr+len should
861f93
+         fall in the watchable region provided by the ptrace interface.  */
861f93
+      if (booke_debug_info.data_bp_alignment
861f93
+	  && (addr + len > (addr & ~(booke_debug_info.data_bp_alignment - 1))
861f93
+	      + booke_debug_info.data_bp_alignment))
861f93
 	return 0;
861f93
     }
861f93
   /* addr+len must fall in the 8 byte watchable region for DABR-based
861f93
861f93
861f93
861f93
commit 1aa4cd774ca674ee6061e2068a410bb67c8bc812
861f93
Author: Andrew Pinski <apinski@cavium.com>
861f93
Date:   Thu Sep 12 07:14:37 2013 +0000
861f93
861f93
    2013-09-12  Andrew Pinski  <apinski@cavium.com>
861f93
    
861f93
    	* aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Zero out regs.
861f93
861f93
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
861f93
index fa3de16..903dcba 100644
861f93
### a/gdb/ChangeLog
861f93
### b/gdb/ChangeLog
861f93
## -1,3 +1,7 @@
861f93
+2013-09-12  Andrew Pinski  <apinski@cavium.com>
861f93
+
861f93
+	* aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Zero out regs.
861f93
+
861f93
 2013-09-10  Andreas Arnez  <arnez@linux.vnet.ibm.com>
861f93
 
861f93
 	* config/s390/s390.mh (NATDEPFILES): Add linux-waitpid.o.
861f93
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
861f93
index 846f156..f685619 100644
861f93
--- a/gdb/aarch64-linux-nat.c
861f93
+++ b/gdb/aarch64-linux-nat.c
861f93
@@ -312,6 +312,7 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
861f93
   const CORE_ADDR *addr;
861f93
   const unsigned int *ctrl;
861f93
 
861f93
+  memset (&regs, 0, sizeof (regs));
861f93
   iov.iov_base = ®s;
861f93
   iov.iov_len = sizeof (regs);
861f93
   count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs;
861f93
861f93
861f93
861f93
commit 05feb1933f80f2d55e132adc657d3152947af3d1
861f93
Author: Will Newton <willnewton@sourceware.org>
861f93
Date:   Thu Oct 10 10:40:42 2013 +0000
861f93
861f93
    gdb/aarch64-linux-tdep.c: Call linux_init_abi.
861f93
    
861f93
    If we are running on a Linux platform we should call linux_init_abi
861f93
    in order to get all the useful hooks it enables.
861f93
    
861f93
    gdb/ChangeLog:
861f93
    
861f93
    2013-10-10  Will Newton  <will.newton@linaro.org>
861f93
    
861f93
    	* aarch64-linux-tdep.c (aarch64_linux_init_abi): Call
861f93
    	linux_init_abi.
861f93
861f93
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
861f93
index 4372579..7a41967 100644
861f93
### a/gdb/ChangeLog
861f93
### b/gdb/ChangeLog
861f93
## -1,3 +1,8 @@
861f93
+2013-10-10  Will Newton  <will.newton@linaro.org>
861f93
+
861f93
+	* aarch64-linux-tdep.c (aarch64_linux_init_abi): Call
861f93
+	linux_init_abi.
861f93
+
861f93
 2013-10-10  Joel Brobecker  <brobecker@adacore.com>
861f93
 
861f93
 	* cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
861f93
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
861f93
index 8e66425..bcfcce2 100644
861f93
--- a/gdb/aarch64-linux-tdep.c
861f93
+++ b/gdb/aarch64-linux-tdep.c
861f93
@@ -270,6 +270,8 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
861f93
 
861f93
   tdep->lowest_pc = 0x8000;
861f93
 
861f93
+  linux_init_abi (info, gdbarch);
861f93
+
861f93
   set_solib_svr4_fetch_link_map_offsets (gdbarch,
861f93
 					 svr4_lp64_fetch_link_map_offsets);
861f93
 
8c62a9
8c62a9
8c62a9
8c62a9
pre-req for:
8c62a9
[PATCH, AArch64] Fix bug in hardware watchpoint/breakpoint handling
8c62a9
commit c623a6ef72a8d7dbbb646345f75646710cb9bb68
8c62a9
Author: Will Newton <willnewton@sourceware.org>
8c62a9
Date:   Mon Sep 16 14:22:19 2013 +0000
8c62a9
8c62a9
    gdbserver, aarch64: Zero out regs in aarch64_linux_set_debug_regs.
8c62a9
    
8c62a9
    Apply the same fix that was applied to aarch64-linux-nat.c.
8c62a9
    
8c62a9
    2013-09-16  Will Newton  <will.newton@linaro.org>
8c62a9
    
8c62a9
    	* linux-aarch64-low.c (aarch64_linux_set_debug_regs): Zero
8c62a9
    	out regs.
8c62a9
8c62a9
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
8c62a9
index 73191f4..1082e78 100644
8c62a9
### a/gdb/gdbserver/ChangeLog
8c62a9
### b/gdb/gdbserver/ChangeLog
8c62a9
## -1,3 +1,8 @@
8c62a9
+2013-09-16  Will Newton  <will.newton@linaro.org>
8c62a9
+
8c62a9
+	* linux-aarch64-low.c (aarch64_linux_set_debug_regs): Zero
8c62a9
+	out regs.
8c62a9
+
8c62a9
 2013-09-06  Pedro Alves  <palves@redhat.com>
8c62a9
 
8c62a9
 	* Makefile.in (gdb_proc_service_h, regdef_h, regcache_h)
8c62a9
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
8c62a9
index e37f602..93246b3 100644
8c62a9
--- a/gdb/gdbserver/linux-aarch64-low.c
8c62a9
+++ b/gdb/gdbserver/linux-aarch64-low.c
8c62a9
@@ -600,6 +600,7 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
8c62a9
   const CORE_ADDR *addr;
8c62a9
   const unsigned int *ctrl;
8c62a9
 
8c62a9
+  memset (&regs, 0, sizeof (regs));
8c62a9
   iov.iov_base = ®s;
8c62a9
   iov.iov_len = sizeof (regs);
8c62a9
   count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs;
8c62a9
8c62a9
8c62a9
8c62a9
[PATCH, AArch64] Fix bug in hardware watchpoint/breakpoint handling
8c62a9
https://sourceware.org/ml/gdb-patches/2013-12/msg00707.html
8c62a9
commit f45c82da381e0ce5ce51b7fb24d0d28611d266b8
8c62a9
Author: Yufeng Zhang <yufeng.zhang@arm.com>
8c62a9
Date:   Wed Dec 18 16:47:33 2013 +0000
8c62a9
8c62a9
    gdb/
8c62a9
    
8c62a9
    	* aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set
8c62a9
    	iov.iov_len with the real length in use.
8c62a9
    
8c62a9
    gdb/gdbserver/
8c62a9
    
8c62a9
    	* linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set
8c62a9
    	iov.iov_len with the real length in use.
8c62a9
8c62a9
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
8c62a9
index 7d9308f..513c593 100644
8c62a9
### a/gdb/ChangeLog
8c62a9
### b/gdb/ChangeLog
8c62a9
## -1,3 +1,8 @@
8c62a9
+2013-12-18  Yufeng Zhang  <yufeng.zhang@arm.com>
8c62a9
+
8c62a9
+	* aarch64-linux-nat.c (aarch64_linux_set_debug_regs): Set
8c62a9
+	iov.iov_len with the real length in use.
8c62a9
+
8c62a9
 2013-12-18  Yao Qi  <yao@codesourcery.com>
8c62a9
 
8c62a9
 	* target.h (target_xfer_partial_ftype): New typedef.
8c62a9
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
8c62a9
index 256725b..7d76833 100644
8c62a9
--- a/gdb/aarch64-linux-nat.c
8c62a9
+++ b/gdb/aarch64-linux-nat.c
8c62a9
@@ -314,10 +314,13 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
8c62a9
 
8c62a9
   memset (&regs, 0, sizeof (regs));
8c62a9
   iov.iov_base = ®s;
8c62a9
-  iov.iov_len = sizeof (regs);
8c62a9
   count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs;
8c62a9
   addr = watchpoint ? state->dr_addr_wp : state->dr_addr_bp;
8c62a9
   ctrl = watchpoint ? state->dr_ctrl_wp : state->dr_ctrl_bp;
8c62a9
+  if (count == 0)
8c62a9
+    return;
8c62a9
+  iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs[count - 1])
8c62a9
+		 + sizeof (regs.dbg_regs [count - 1]));
8c62a9
 
8c62a9
   for (i = 0; i < count; i++)
8c62a9
     {
8c62a9
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
8c62a9
index c73840f..2847796 100644
8c62a9
### a/gdb/gdbserver/ChangeLog
8c62a9
### b/gdb/gdbserver/ChangeLog
8c62a9
## -1,3 +1,8 @@
8c62a9
+2013-12-18  Yufeng Zhang  <yufeng.zhang@arm.com>
8c62a9
+
8c62a9
+	* linux-aarch64-low.c (aarch64_linux_set_debug_regs): Set
8c62a9
+	iov.iov_len with the real length in use.
8c62a9
+
8c62a9
 2013-12-13  Joel Brobecker  <brobecker@adacore.com>
8c62a9
 
8c62a9
 	* Makefile.in (safe-ctype.o, lbasename.o): New rules.
8c62a9
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
8c62a9
index 93246b3..c2d271a 100644
8c62a9
--- a/gdb/gdbserver/linux-aarch64-low.c
8c62a9
+++ b/gdb/gdbserver/linux-aarch64-low.c
8c62a9
@@ -602,10 +602,13 @@ aarch64_linux_set_debug_regs (const struct aarch64_debug_reg_state *state,
8c62a9
 
8c62a9
   memset (&regs, 0, sizeof (regs));
8c62a9
   iov.iov_base = ®s;
8c62a9
-  iov.iov_len = sizeof (regs);
8c62a9
   count = watchpoint ? aarch64_num_wp_regs : aarch64_num_bp_regs;
8c62a9
   addr = watchpoint ? state->dr_addr_wp : state->dr_addr_bp;
8c62a9
   ctrl = watchpoint ? state->dr_ctrl_wp : state->dr_ctrl_bp;
8c62a9
+  if (count == 0)
8c62a9
+    return;
8c62a9
+  iov.iov_len = (offsetof (struct user_hwdebug_state, dbg_regs[count - 1])
8c62a9
+		 + sizeof (regs.dbg_regs [count - 1]));
8c62a9
 
8c62a9
   for (i = 0; i < count; i++)
8c62a9
     {