Home | History | Annotate | Download | only in patches
      1 diff -urN bug-buddy-2.12.1/configure.in bug-buddy-2.12.1-hacked/configure.in
      2 --- bug-buddy-2.12.1/configure.in	2005-10-01 14:38:24.000000000 +1200
      3 +++ bug-buddy-2.12.1-hacked/configure.in	2005-10-26 16:10:33.689331000 +1300
      4 @@ -86,7 +86,12 @@
      5  fi
      6  AC_DEFINE_UNQUOTED(GNOMELIBEXECDIR, "$GNOMELIBEXECDIR", [Libexec directory])
      7  
      8 -
      9 +AC_CANONICAL_HOST
     10 +case "$host" in
     11 +*solaris*)
     12 +       AC_DEFINE(SOLARIS,1,Define to 1 if solaris)
     13 +       ;;
     14 +esac
     15  
     16  AC_OUTPUT([
     17  bug-buddy.spec
     18 diff -urN bug-buddy-2.12.1/src/gdb-buddy.c bug-buddy-2.12.1-hacked/src/gdb-buddy.c
     19 --- bug-buddy-2.12.1/src/gdb-buddy.c	2005-07-20 06:49:18.000000000 +1200
     20 +++ bug-buddy-2.12.1-hacked/src/gdb-buddy.c	2005-10-26 16:40:09.449769000 +1300
     21 @@ -152,15 +152,28 @@
     22  	int status;
     23  	FILE *f;
     24  
     25 -	gdb_cmd = g_strdup_printf ("gdb --batch --core=%s", core_file);
     26 +	gboolean use_pstack = FALSE;
     27 +
     28 +#ifdef SOLARIS
     29 +        char *gdb = g_find_program_in_path ("gdb");
     30 +        if (gdb)
     31 +#endif
     32 +                gdb_cmd = g_strdup_printf ("gdb --batch --core=%s", core_file);
     33 +#ifdef SOLARIS
     34 +        else {
     35 +                gdb_cmd = g_strdup_printf ("pstack %s", core_file);
     36 +		use_pstack = TRUE;
     37 +	}
     38 +#endif
     39  
     40  	f = popen (gdb_cmd, "r");
     41  	g_free (gdb_cmd);
     42  
     43  	if (!f) {
     44  		buddy_error (GET_WIDGET ("druid-window"),
     45 -			     _("Unable to process core file with gdb:\n"
     46 +			     _("Unable to process core file with %s:\n"
     47  			       "'%s'"),
     48 +			     use_pstack ? "pstack" : "gdb",
     49  			     core_file);
     50  		return;
     51  	}
     52 @@ -178,14 +191,31 @@
     53  				binary = g_strdup(s);
     54  			}
     55  		}
     56 +#ifdef SOLARIS
     57 +                else if (!binary && !strncmp(buf, "core ", 4)) {
     58 +                        gchar *s;
     59 +                        gchar *ptr = buf;
     60 +                        while (*ptr != ':' && *ptr !='\0') ptr++;
     61 +                        if (*ptr == ':') {
     62 +                                ptr++;
     63 +                                while (*ptr == ' ' || *ptr == '\t') ptr++;
     64 +                                s = ptr;
     65 +                                while (*ptr !='\0') ptr++;
     66 +                                *ptr = '\0';
     67 +                                binary = g_strdup(s);
     68 +                        }
     69 +                }
     70 +#endif
     71 +
     72  	}
     73  
     74  	status = pclose(f);
     75  
     76  	if (!binary) {
     77  		buddy_error (GET_WIDGET ("druid-window"),
     78 -			     _("GDB was unable to determine which binary created\n"
     79 +			     _("%s was unable to determine which binary created\n"
     80  			       "'%s'"),
     81 +                             use_pstack ? "pstack" : "gdb",
     82  			     core_file);
     83  		return;
     84  	}	
     85 @@ -254,17 +284,33 @@
     86  	const char *short_app;
     87  	char *long_app;
     88  	GError *error = NULL;
     89 -	char *args[] = { "gdb",
     90 -			 "--batch", 
     91 -			 "--quiet",
     92 -			 "--command=" BUDDY_DATADIR "/gdb-cmd",
     93 -			 NULL, NULL, NULL };
     94 -
     95 -	if (!app || !extra || !*app || !*extra) {
     96 +        char *args[7];
     97 +        char *gdb = g_find_program_in_path ("gdb");
     98 +	gboolean use_pstack = FALSE;
     99 + 
    100 +         if (!app || !extra || !*app || !*extra) {
    101  		buddy_error (GET_WIDGET ("druid-window"), 
    102  			     _("Both a binary file and PID are required to debug."));
    103 -		return;
    104 +                 return;
    105  	}
    106 + 
    107 +        if (gdb) {
    108 +                args[0] =  gdb;
    109 +                args[1] = "--batch";
    110 +                args[2] = "--quiet";
    111 +                args[3] = "--command=" BUDDY_DATADIR "/gdb-cmd";
    112 +                args[4] = NULL;
    113 +                args[5] = (char *)extra;
    114 +                args[6] = NULL;
    115 +        }
    116 +#ifdef SOLARIS
    117 +        else {
    118 +                args[0] = g_find_program_in_path ("pstack");
    119 +                args[1] = (char *)extra;
    120 +                args[2] = args[3] = args[4] =  args[5] = args[6] = NULL;
    121 +		use_pstack = TRUE;
    122 +        }
    123 +#endif
    124  
    125  	if (app[0] == G_DIR_SEPARATOR) {
    126  		long_app = g_strdup (app);
    127 @@ -287,14 +333,13 @@
    128  		return;
    129  	}
    130  
    131 -	args[0] = g_find_program_in_path ("gdb");
    132 -	args[4] = long_app;
    133 -	args[5] = (char *)extra;
    134 +	if (!use_pstack)
    135 +		args[4] = long_app;
    136  
    137  	if (!args[0]) {
    138  		buddy_error (GET_WIDGET ("druid-window"),
    139 -			     _("GDB could not be found on your system.\n"
    140 -			       "Debugging information will not be obtained."));
    141 +			     _("%s could not be found on your system.\n"
    142 +			       "Debugging information will not be obtained."), use_pstack ? "pstack" : "gdb");
    143  		d(g_message ("Path: %s", getenv ("PATH")));
    144  	} else {
    145  		d(g_message ("About to debug '%s'", long_app));
    146 @@ -309,7 +354,7 @@
    147  					       &druid_data.fd, 
    148  					       NULL, &error)) {
    149  			buddy_error (GTK_WIDGET ("druid-window"),
    150 -				     _("There was an error running gdb:\n\n%s"),
    151 +				     _("There was an error running %s:\n\n%s"), use_pstack ? "pstack" : "gdb",
    152  				     error->message);
    153  			g_error_free (error);
    154  		} else {
    155