changeset 10360:9126d71f53aa

add gdbinit file to sources
author John W. Eaton <jwe@octave.org>
date Thu, 25 Feb 2010 12:02:39 -0500
parents ec05728ce7f0
children b4f67ca318d8
files ChangeLog Makefile.am gdbinit
diffstat 3 files changed, 64 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Feb 25 14:45:32 2010 +0100
+++ b/ChangeLog	Thu Feb 25 12:02:39 2010 -0500
@@ -1,3 +1,10 @@
+2010-02-25  John W. Eaton  <jwe@octave.org>
+
+	* gdbinit: New file.
+	* Makefile.am (EXTRA_DIST): Add it to the list.
+	(all-local): Depend on .gdbinit.
+	(.gdbinit): New rule.
+
 2010-02-22  John W. Eaton  <jwe@octave.org>
 
 	* boostrap: Update from gnulib/build-aux/bootstrap.
--- a/Makefile.am	Thu Feb 25 14:45:32 2010 +0100
+++ b/Makefile.am	Thu Feb 25 12:02:39 2010 -0500
@@ -52,6 +52,7 @@
   ROADMAP \
   SENDING-PATCHES \
   autogen.sh \
+  gdbinit \
   missing \
   mk-opts.pl \
   mkinstalldirs \
@@ -102,7 +103,7 @@
 
 nodist_octinclude_HEADERS = config.h
 
-all-local: $(bin_SCRIPTS) $(INFO_FILES)
+all-local: $(bin_SCRIPTS) $(INFO_FILES) .gdbinit
 	@echo ""
 	@echo "Octave successfully built.  Now choose from the following:"
 	@echo ""
@@ -154,6 +155,13 @@
 	@$(do_subst_script_vals)
 	chmod a+rx "$@"
 
+.gdbinit: gdbinit
+	if [ -f .gdbinit ]; then \
+	  echo "refusing to overwrite .gdbinit with newer version from $<" 1>&2; \
+	else \
+	  cp $< $@; \
+	fi
+
 BUGS INSTALL.OCTAVE:
 	$(MAKE) -C doc ../$@
 .PHONY: BUGS INSTALL.OCTAVE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gdbinit	Thu Feb 25 12:02:39 2010 -0500
@@ -0,0 +1,48 @@
+## Helpful macros for debugging Octave.
+
+## Display a dim-vector object.
+
+define display-dims
+  echo ndims: \ 
+  output $arg0.rep[-1]
+  echo \ndims: \ 
+  output *$arg0.rep@$arg0.rep[-1]
+  echo \n
+  dont-repeat
+end
+
+## Display a dense array object.
+
+define display-dense-array
+  echo array object: \ 
+  output $arg0
+  echo \ndimensions:\n
+  display-dims $arg0.dimensions
+  echo \nrep = \ 
+  output *$arg0.rep
+  echo \nrep.data = \ 
+  output *$arg0.rep.data@$arg0.rep.len
+  echo \n
+  dont-repeat
+end
+
+## Display a sparse array object.
+
+define display-sparse-array
+  echo sparse object: \ 
+  output $arg0
+  echo \ndimensions.rep[0] = \ 
+  display-dims $arg0.dimensions
+  echo \ndimensions.rep[1] = \ 
+  output $arg0.dimensions.rep[1]
+  echo \nrep = \ 
+  output *$arg0.rep
+  echo \nrep.d = \ 
+  output *$arg0.rep.d@$arg0.rep.nzmx
+  echo \nrep.r = \ 
+  output *$arg0.rep.r@$arg0.rep.nzmx
+  echo \nrep.c = \ 
+  output *$arg0.rep.c@($arg0.rep.ncols+1)
+  echo \n
+  dont-repeat
+end