This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA] re-read symbols before "start"-ing...


> > 2005-03-07  Joel Brobecker  <brobecker@adacore.com>
> > 
> >         * infcmd.c (start_command): Make sure the symbols are up to date
> >         before setting the temporary breakpoint.
> 
> Just my two cents, but I think you may want to add an argument to
> run_command, instead, and create the breakpoint there.  For instance
> there's probably a case where you'll need reopen_exec_file ().  And
> reread_symbols is passably expensive - lots of stat().

I wasn't too concerned about the expensiveness of reread_symbols,
because I think the "start" command is used only once in a while,
so the performance hit should be only occasional. I was also hoping,
but this is only guessing game on my part, that the system would cache
theses operations so that the next stat operations are made from memory,
and hence be very fast.

However, I see your point with reopen_exec_file(), though.

How about the following patch? Because run_command is used as a callback
for the "run" command, I couldn't change its profile, so instead I
extracted its body into run_command_1, and added the extra parameter
there. On my first try, I was a bit silly, because I made this parameter
a char * containing the location of the temporary breakpoint. I then
called this procedure like this (in start_command()):

        run_command_1 (args, from_tty, main_name());

Which doesn't work, since we still end up calling main_main() before
we have verified whether symbols should be reread or not. So instead,
I settled for a flag. And we get to simplify start_command() a bit,
by removing some code that is no longer needed (the call to
kill_if_already_running()).

2005-03-08  Joel Brobecker  <brobecker@adacore.com>

        * infcmd.c (run_command_1): New function, extracted from
        run_command.
        (run_command): Replace implementation by call to run_command_1.
        (start_command): Use run_command_1 to insert the temporary
        breakpoint and run the program. Remove code that's no longer
        needed, as already done at the proper time by run_command_1.

Tested on x86-linux, no regression. I have a testcase that I will submit
shortly that used to fail before the change, and passes after.

OK to apply?

Thanks,
-- 
Joel

Attachment: restart.diff
Description: Text document


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