[Pstack-gdb-commits] manish commits r4 - in trunk: . src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Mar 22 21:20:58 CST 2004


Author: manish
Date: 2004-03-22 21:20:56 -0600 (Mon, 22 Mar 2004)
New Revision: 4

Added:
   trunk/ChangeLog
   trunk/pstack-gdb.spec.in
Modified:
   trunk/Makefile
   trunk/configure.in
   trunk/src/Makefile
   trunk/src/pstack-gdb.c
Log:
* 0.2.0 release.
                                                                                
* pstack-gdb.spec.in: spec file template.
                                                                                
* configure.in: bump version number, generate spec file.
                                                                                
* Makefile: dist ChangeLog and spec.in.
                                                                                
* src/pstack-gdb.c: add --help and --version command line options.
                                                                                
* src/Makefile: define PSTACK_VERSION.



Added: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-03-20 12:45:54 UTC (rev 3)
+++ trunk/ChangeLog	2004-03-23 03:20:56 UTC (rev 4)
@@ -0,0 +1,17 @@
+Mon Mar 22 19:18:20 2004  Manish Singh  <manish.singh at oracle.com>
+
+	* 0.2.0 release.
+
+	* pstack-gdb.spec.in: spec file template.
+
+	* configure.in: bump version number, generate spec file.
+
+	* Makefile: dist ChangeLog and spec.in.
+
+	* src/pstack-gdb.c: add --help and --version command line options.
+
+	* src/Makefile: define PSTACK_VERSION.
+
+Sat Mar 20 04:44:12 2004  Manish Singh  <manish.singh at oracle.com>
+
+	* Initial 0.1.0 release.

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2004-03-20 12:45:54 UTC (rev 3)
+++ trunk/Makefile	2004-03-23 03:20:56 UTC (rev 4)
@@ -5,16 +5,18 @@
 SUBDIRS = src
 
 DIST_FILES = \
-	COPYING		\
-	Config.make.in	\
-	Preamble.make	\
-	Postamble.make	\
-	config.guess	\
-	config.sub	\
-	configure	\
-	configure.in	\
-	install-sh	\
-	mkinstalldirs
+	COPYING			\
+	ChangeLog		\
+	Config.make.in		\
+	Preamble.make		\
+	Postamble.make		\
+	config.guess		\
+	config.sub		\
+	configure		\
+	configure.in		\
+	install-sh		\
+	mkinstalldirs		\
+	pstack-gdb.spec.in
 
 .PHONY: dist dist-bye dist-fresh distclean
 

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2004-03-20 12:45:54 UTC (rev 3)
+++ trunk/configure.in	2004-03-23 03:20:56 UTC (rev 4)
@@ -5,7 +5,7 @@
 AC_SUBST(PACKAGE)
 
 MAJOR_VERSION=0
-MINOR_VERSION=1
+MINOR_VERSION=2
 MICRO_VERSION=0
 
 DIST_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
@@ -44,4 +44,7 @@
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-AC_OUTPUT([Config.make])
+AC_OUTPUT([
+Config.make
+pstack-gdb.spec
+])

Added: trunk/pstack-gdb.spec.in
===================================================================
--- trunk/pstack-gdb.spec.in	2004-03-20 12:45:54 UTC (rev 3)
+++ trunk/pstack-gdb.spec.in	2004-03-23 03:20:56 UTC (rev 4)
@@ -0,0 +1,47 @@
+#
+# Spec file for pstack-gdb
+#
+
+Summary: Display stack trace of a running process using GDB
+Name: pstack-gdb
+Version: @VERSION@
+Release: 1
+Copyright: GPL
+Group: Development/Debuggers
+Source: %{name}-%{version}.tar.gz
+URL: http://oss.oracle.com/projects/pstack-gdb/
+Distribution: Oracle
+Vendor: Oracle Corporation
+Packager: nobody <nobody at oracle.com>
+Requires: glib2 >= 2.2.0
+BuildRequires: glib2-devel >= 2.2.0
+BuildRoot: %{_tmppath}/%{name}-root
+
+%description
+pstack-gdb dumps a stack trace for a process, given a list of pids to dump.
+If the process is threads, a stack trace will be printed for each thread.
+It is a just a wrapper around GDB; the debugger does the real heavy lifting.
+
+%prep
+%setup -q
+
+%build
+%configure --prefix=/usr --bindir=%{_bindir} --mandir=%{_mandir}
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR="$RPM_BUILD_ROOT"
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+                                                                                
+%files
+%defattr(-,root,root)
+%doc COPYING
+%{_bindir}/pstack-gdb
+#%{_mandir}/man1/*
+
+%changelog
+* Mon Mar 22 2004 Manish Singh <manish.singh at oracle.com> 0.2.0-1
+- Initial packaging

Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2004-03-20 12:45:54 UTC (rev 3)
+++ trunk/src/Makefile	2004-03-23 03:20:56 UTC (rev 4)
@@ -8,6 +8,8 @@
 
 DIST_FILES = pstack-gdb.c
 
+DEFINES = -DPSTACK_VERSION=\"$(VERSION)\"
+
 pstack-gdb: pstack-gdb.o
 	$(LINK) $(GLIB_LIBS)
 

Modified: trunk/src/pstack-gdb.c
===================================================================
--- trunk/src/pstack-gdb.c	2004-03-20 12:45:54 UTC (rev 3)
+++ trunk/src/pstack-gdb.c	2004-03-23 03:20:56 UTC (rev 4)
@@ -70,6 +70,9 @@
 typedef struct _App App;
 
 
+static void        print_version          (void);
+static void        usage                  (gchar         *prgname);
+
 static GIOChannel *new_io_channel         (gint           fd);
 
 static GSList     *get_pid_list           (gint           argc,
@@ -102,6 +105,24 @@
 					   App           *app);
 
 
+static void
+print_version (void)
+{
+  g_print ("pstack-gdb version " PSTACK_VERSION "\n");
+  g_print ("Written by Manish Singh.\n\n");
+  g_print ("Copyright (C) 2004 Oracle.\n");
+}
+
+static void
+usage (gchar *prgname)
+{
+  g_print ("Usage: %s [OPTION] pid [...]\n\n", prgname);
+  g_print ("Specify one or more pids to print a stack trace for each.\n\n");
+  g_print ("Options:\n");
+  g_print ("  -V, --version  print version information and exit\n");
+  g_print ("      --help     display this help and exit\n");
+}
+
 static GIOChannel *
 new_io_channel (gint fd)
 {
@@ -139,7 +160,7 @@
 
   if (argc < 2)
     {
-      g_printerr ("No valid pids given\n");
+      g_printerr ("No valid pids given\n\n");
       return NULL;
     }
 
@@ -152,7 +173,7 @@
 
       if (*endptr != '\0' || pid <= 0 || pid > G_MAXINT || errno != 0)
         {
-          g_printerr ("Invalid pid: %s\n", argv[i]);
+          g_printerr ("Invalid pid: %s\n\n", argv[i]);
           g_slist_free (pids);
           return NULL;
         }
@@ -521,13 +542,37 @@
 main (int    argc,
       char **argv)
 {
-  App       *app;
-  GSList    *pids;
+  App    *app;
+  GSList *pids;
+  gint    i;
 
+  for (i = 1; i < argc; i++)
+    {
+      if ((strcmp (argv[i], "--version") == 0) ||
+	  (strcmp (argv[i], "-V") == 0))
+	{
+	  print_version ();
+	  exit (0);
+	}
+      else if (strcmp (argv[i], "--help") == 0)
+	{
+	  usage (argv[0]);
+	  exit (0);
+	}
+      else if (*argv[i] == '-')
+	{
+	  usage (argv[0]);
+	  exit (1);
+	}
+    }
+
   pids = get_pid_list (argc, argv);
 
   if (!pids)
-    exit (1);
+    {
+      usage (argv[0]);
+      exit (1);
+    }
 
   app = g_new0 (App, 1);
 



More information about the Pstack-gdb-commits mailing list