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]

[PATCH v13 3/4] Add support for lookup, overload resolution and invocation of C++ debug methods


This version addresses all of Doug's comments on v12.

v12 posting: https://sourceware.org/ml/gdb-patches/2014-04/msg00014.html
Doug's review: https://sourceware.org/ml/gdb-patches/2014-04/msg00107.html

Doug had this comment:

Doug> The following code to handle dynamic types seems excessively
Doug> complex. Plus we do a lot of work only to throw it away and start
Doug> over (by calling find_overload_match on the dynamic type).
Doug> Maybe instead of starting over, just look for the debug method on the
Doug> dynamic type and use that if it exists?  Thoughts?

I agree that calling find_overload_match again will do repetitive
work. But, lets say the dynamic type does have a matching debug method
worker. In which case, it has to be compared with the matching virtual
function. find_overload_match does this comparison for us. If we do
not want to call find_overload_match again, then we will have to 1)
pull out the debug method specific parts of find_overload_match and
its helpers and make them separate functions, 2) pull out that part of
find_overload_match which compares source methods and debug methods to
decide who wins and make it a separate function. I took the easier
route of calling find_overload_match again. I am not sure if splitting
find_overload_match would reduce the complexity of this part of the
code. Also, find_overload_match will only be called once more: not too
bad may be?

ChangeLog:
2014-04-09  Siva Chandra Reddy  <sivachandra@google.com>

        * eval.c: #include "extension.h".
        (evaluate_subexp_standard): Lookup and invoke C++ methods defined
        in extension languages.
        * valarith.c: #include "extension.h".
        (value_user_defined_cpp_op): Add "src_fn" and "dm_worker"
        arguments.  Return void.  A source match is returned in "src_fn",
        and a debug method match is returned in "dm_worker".
        (value_user_defined_op): Likewise.
        (value_x_binop, value_x_unop): Lookup and invoke
        overloaded operator methods defined in extension languages.
        * valops.c: #include "extension.h".
        (find_method_list): Add "fn_list" and "dm_worker_vec" arguments.
        Return void.  The list of matching source methods is returned in
        "fn_list" and a vector of matching debug method workers is
        returned in "dm_worker_vec".
        (value_find_oload_method_list): Likewise.
        (find_overload_match): Add "dm_worker" parameter.  If the best
        method match is a debug method, then it is returned in
        "dm_worker".  All callers updated.
        (find_oload_champ): Add "dm_worker_vec" argument.  If a caller
        wants to find the champion among a set of debug methods, then it
        has to pass the debug methods in "dm_worker_vec".  All callers
        updated.
        (value_has_indirect_dynamic_type): New function.
        * value.h (find_overload_match): Update signature.

Attachment: dm_cpp_v13.txt
Description: Text document


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