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: PING^8 Re: [RFC] Have an option to tell GDB to detect and possibly handle mismatched exec-files.


>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:

Philippe> Ping ?
Philippe> (attaching a patch rebased on recent master)

I'm sorry for the extreme delay on this.

I read through the thread a bit, and I looked briefly at the other
threads in the past.  I didn't read those exhaustively though.

Philippe> This patch series implements a new option:
Philippe>   (gdb) apropos exec-file-mismatch
Philippe>   set exec-file-mismatch -- Set exec-file-mismatch handling
Philippe>   show exec-file-mismatch -- Show exec-file-mismatch handling

Seems reasonable.

Philippe> The same tests as above then give:
[...]

Philippe>   (gdb) atta 31069
Philippe>   Attaching to program: /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers, process 31069
Philippe>   warning: Mismatch between current exec-file /home/philippe/valgrind/git/trunk_untouched/gdbserver_tests/sleepers
Philippe>   and automatically determined exec-file /bd/home/philippe/gdb/git/build_fixes/gdb/gdb
Philippe>   exec-file-mismatch handling is currently "reload"
Philippe>   Load new symbol table from "/bd/home/philippe/gdb/git/build_fixes/gdb/gdb"? (y or n) y
Philippe>   Reading symbols from /bd/home/philippe/gdb/git/build_fixes/gdb/gdb...

Nice.

Philippe> +enum exec_file_mismatch_mode exec_file_mismatch_mode = exec_file_mismatch_reload;

This can be "static".

Philippe> Still missing:
Philippe>   ChangeLog
Philippe>   NEWS
Philippe>   user manual

... still needs these, but I completely understand why you put off
writing them.

Philippe> +void
Philippe> +validate_exec_file (int from_tty)
Philippe> +{
Philippe> +  if (exec_file_mismatch_mode == exec_file_mismatch_off)
Philippe> +    return; /* User asked to do nothing.  */

Normally gdb prefers comments not to be at the end of the line like
this.  It's fine to just stick them before the "if", maybe reworded
sometimes.

Philippe> +  char *current_exec_file = get_exec_file (0);

Could be const.

Philippe> +  /* Try to determine a filename from the process itself.  */
Philippe> +  char *pid_exec_file = target_pid_to_exec_file (inf->pid);

Also could be const.

Philippe> +  if (strcmp (exec_file_target.c_str (), current_exec_file) != 0)

This can just use !=, because exec_file_target is a std::string.

Philippe> +    {
Philippe> +      warning (_("Mismatch between current exec-file %s\n"
Philippe> +		 "and automatically determined exec-file %s\n"
Philippe> +		 "exec-file-mismatch handling is currently \"%s\""),

I wonder whether the newlines are needed?  And also if now this should
use %ps and styled_string and file_name_style?


What happens if the inferior exec()s something else?  Also why was a
validate call required in remote.c but not in any other target?

thanks,
Tom


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