Home | History | Annotate | Download | only in patches
      1 --- bug-buddy-2.20.1.old/gnome-breakpad/gnome-breakpad.cc	2007-10-08 11:54:17.291663000 +0100
      2 +++ bug-buddy-2.20.1/gnome-breakpad/gnome-breakpad.cc	2007-10-08 13:05:10.523038000 +0100
      3 @@ -223,25 +223,52 @@
      4  static bool
      5  run_gdb (const gchar *appname, pid_t pid)
      6  {
      7 -	gchar *exec_str;
      8 +	gchar *exec_str = NULL;
      9  	gchar *title;
     10  	gboolean res;
     11  	GError *error = NULL;
     12 +	gchar *gdb = NULL;
     13  
     14  	title = g_strdup_printf ("Debugging %s", appname);
     15  
     16 +#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
     17 +	gdb = g_find_program_in_path("gdb");;
     18 +	if (gdb) {
     19 +		exec_str = g_strdup_printf("gnome-terminal "
     20 +				 "--title=\"%s\" "
     21 +				 "--disable-factory "
     22 +				 "--command=\"gdb %s %d\"",
     23 +				title, appname, (int)pid);
     24 +		g_free (gdb);
     25 +	} else {
     26 +		gchar *dbx = g_find_program_in_path("dbx");
     27 +		if (dbx) {
     28 +			exec_str = g_strdup_printf("gnome-terminal "
     29 +				 	"--title=\"%s\" "
     30 +				 	"--disable-factory "
     31 +				 	"--command=\"dbx /proc/%d/object/a.out %d\"",
     32 +					title, (int)pid, (int)pid);
     33 +		}
     34 +		g_free (dbx);
     35 +	}
     36 +#else
     37  	exec_str = g_strdup_printf("gnome-terminal "
     38  				 "--title=\"%s\" "
     39  				 "--disable-factory "
     40  				 "--command=\"gdb %s %d\"",
     41  				title, appname, (int)pid);
     42 -				g_free (title);
     43 -	res = g_spawn_command_line_sync (exec_str, NULL, NULL,
     44 +#endif /* defined(sun) && defined(__SVR4) */
     45 +
     46 +	g_free (title);
     47 +
     48 +	if (exec_str) {
     49 +		res = g_spawn_command_line_sync (exec_str, NULL, NULL,
     50  					 NULL, &error);
     51 -	g_free(exec_str);
     52 -	if (!res) {
     53 -		g_warning("Couldn't run debugger\n");
     54 -		return false;
     55 +		g_free(exec_str);
     56 +		if (!res) {
     57 +			g_warning("Couldn't run debugger\n");
     58 +			return false;
     59 +		}
     60  	}
     61  
     62  	return true;
     63 @@ -251,7 +278,11 @@
     64  check_if_gdb (void *callback_context)
     65  {
     66  	char mypath[255];
     67 -	gchar *gdb;
     68 +	gchar *gdb = NULL;
     69 +#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
     70 +	gchar *pstack = NULL;
     71 +	gchar *dbx = NULL;
     72 +#endif /* defined(sun) && defined(__SVR4) */
     73  	bool has_debug_symbols;
     74  	char *filename;
     75  	gchar *appname;
     76 @@ -265,9 +296,21 @@
     77  
     78  	appname = g_get_prgname ();
     79  	pid = getpid ();
     80 +
     81 +#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
     82 +	gdb = g_find_program_in_path ("gdb");
     83 +	pstack = g_find_program_in_path ("pstack");
     84 +	dbx = g_find_program_in_path ("dbx");
     85 +
     86 +	if (!gdb)
     87 +		pstack = g_find_program_in_path ("pstack");
     88 +	
     89 +	if ((gdb || dbx) && g_getenv("GNOME_HACKER")) {
     90 +#else
     91  	gdb = g_find_program_in_path ("gdb");
     92  
     93  	if (gdb && g_getenv("GNOME_HACKER")) {
     94 +#endif /* defined(sun) && defined(__SVR4) */
     95  		res = run_gdb (appname, pid);
     96  		if (!res)
     97  			_exit (1);
     98 @@ -279,7 +322,11 @@
     99  	has_debug_symbols = elf_has_debug_symbols (mypath);
    100  
    101  
    102 +#if defined(__SUNPRO_CC) || (defined(__GNUC__) && defined(__sun__))
    103 +	if (bugbuddy && (gdb || pstack)) {
    104 +#else
    105  	if (bugbuddy && gdb && has_debug_symbols) {
    106 +#endif /* defined(sun) && defined(__SVR4) */
    107  		res = run_bug_buddy (appname, pid, NULL);
    108  		if (!res)
    109  			_exit (1);
    110