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: [RFC/RFA] handle function homonyms in breakpoint expressions


> The idea is to short-circuit the end of decode_line_1 and call the
> Ada-specific part instead, like so:
> 
>    else if (current_language->la_language == language_ada)
>      {
>        return ada_finish_decode_line_1 (argptr, file_symtab, funfirstline,
>                                         canonical, not_found_ptr);
>      }

Actually, I forgot one small piece.  Inside linespec.c:locate_first_half,
we need to do handle the parsing a little bit differently for Ada.
This is because we re-write the breakpoint location expression in
a canonical form that is unambiguous. For that, we use the form
FILE:FUN_NAME:LINE_NO. As a result, the parsing needs to be adjusted
for Ada. We do this by adding the following code in locate_first_half:

  if (current_language->la_language == language_ada)
    p = ada_start_decode_line_1 (*argptr, *is_quote_enclosed);
  else for (; *p; p++)
    [do the normal expression splitting]

Without the above, we managed to insert the breakpoint, but once
we run the program, the breakpoint re-evaluations fail and, causing
these breakpoints to be unexpectedly disabled.

The new patch is identical to the previous one, with the addition of
ada_start_decode_line_1, and a call to that function in linespec.c.

New ChangeLog:

2008-01-02  Joel Brobecker  <brobecker@adacore.com>
        
        * ada-lang.c (get_selections): Set prompt explicitly when calling
        command_line_input, or it will print the GDB prompt.
        (can_use_symbol_on_breakpoint, discard_non_breakpoint_matches)
        (ada_finish_decode_line_1, find_sal_from_funcs_and_line)
        (find_line_in_linetable, nearest_line_number_in_linetable)
        (find_next_line_in_linetable, is_plausible_func_for_line)
        (read_all_symtabs, ada_sals_for_line, extended_canonical_line_spec)
        (adjust_pc_past_prologue, ada_start_decode_line_1): New functions.
        * ada-lang.h (ada_start_decode_line_1): Update profile.
        (ada_finish_decode_line_1): Likewise.
        * linespec.c: #include ada-lang.h.
        (decode_line_1): Add call to ada_finish_decode_line_1.
        (locate_first_half): Add call to ada_start_decode_line_1.
        * Makefile.in (linespec.o): Update dependencies.
    
Tested on x86-linux. No regression.
Thoughts?

Thanks,
-- 
Joel

Attachment: overload.diff
Description: Text document


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