This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patchv3 1/5] Mostly code cleanup: Constification


Jan Kratochvil writes:
 > Hi,
 > 
 > this is mostly a code cleanup, just the main.c part is not exactly the same.
 > 
 > 
 > Jan
 > 
 > 
 > gdb/
 > 2013-09-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
 > 
 > 	Constification.
 > 	* main.c (captured_main): Wrap symbol_file_add_main calls with
 > 	TRY_CATCH.  Twice.
 > 	* symfile.c (symbol_file_add_main_1): Make args parameter const.
 > 	(symbol_file_add): Make name parameter const.
 > 	(symbol_file_add_main, symbol_file_add_main_1): Make args parameter const.
 > 	(symfile_bfd_open): Make name parameter const, rename it to cname.  Add
 > 	variable name.  Change their usage accordingly.
 > 	* symfile.h (symbol_file_add, symfile_bfd_open): Make first parameter
 > 	const.
 > 	(symbol_file_add_main): Make args parameter const.
 > 
 > --- a/gdb/main.c
 > +++ b/gdb/main.c
 > @@ -950,8 +950,15 @@ captured_main (void *data)
 >           catch_command_errors returns non-zero on success!  */
 >        if (catch_command_errors (exec_file_attach, execarg,
 >  				!batch_flag, RETURN_MASK_ALL))
 > -	catch_command_errors (symbol_file_add_main, symarg,
 > -			      !batch_flag, RETURN_MASK_ALL);
 > +	{
 > +	  volatile struct gdb_exception e;
 > +
 > +	  TRY_CATCH (e, RETURN_MASK_ALL)
 > +	    {
 > +	      symbol_file_add_main (symarg, !batch_flag);
 > +	    }
 > +	  exception_print (gdb_stderr, e);
 > +	}
 >      }
 >    else
 >      {
 > @@ -959,8 +966,15 @@ captured_main (void *data)
 >  	catch_command_errors (exec_file_attach, execarg,
 >  			      !batch_flag, RETURN_MASK_ALL);
 >        if (symarg != NULL)
 > -	catch_command_errors (symbol_file_add_main, symarg,
 > -			      !batch_flag, RETURN_MASK_ALL);
 > +	{
 > +	  volatile struct gdb_exception e;
 > +
 > +	  TRY_CATCH (e, RETURN_MASK_ALL)
 > +	    {
 > +	      symbol_file_add_main (symarg, !batch_flag);
 > +	    }
 > +	  exception_print (gdb_stderr, e);
 > +	}
 >      }
 >  
 >    if (corearg && pidarg)

There is catch_command_errors_const.
Would that work here?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]