Hi Ben!

Thanks for your quick reply. Hope things are going great for you too! Haven't seen Bart for a while now, but you're both very welcome to pay a visit anytime :)

The vector returned (found_funcs) always contains 1 single match (I made sure to clear it before every new call to findFunction). In the case of "MPI_INIT", the output is the same again, 1 single match against "mpi_init__". I also tried calling findFunction with the whole set of arguments just to make sure that the case_sensitive boolean is set to true, but it makes no difference.

Is there any debug variable that I may turn on that would help to see what's going on, or anything else that I could try?

Thanks!
-- G.


On 15/7/19 20:17, Benjamin Welton wrote:
Hey German,

Hope things are going well over at BSC (hopefully Bart stopped in for a visit). Does the vector returned (found_funcs) contain all of the mpi_init functions or just the one (on binaries that contain multiple mpi_init functions with the exception of MPI_INIT)? Does searching for "MPI_INIT" yield the correct result?

If so, i am not surprised to see this behavior though it likely isn't expected (or what the regex parser should be doing).

Ben.



On Mon, Jul 15, 2019 at 10:22 AM Germán Llort <gll...@bsc.es <mailto:gll...@bsc.es>> wrote:

    Hi,

    We're using BPatch_image->findFunction() to look for MPI symbols in a
    binary. When the binary is Fortran code, different compilers may add
    different decorations to the MPI functions. For example, for
    "MPI_Init",
    different compilers may end up naming this function like:

    - mpi_init  (all lowercase)
    - mpi_init_ (1 underscore at the end)
    - mpi_init__ (2 underscores at the end)
    - MPI_INIT (all uppercase)

    And sometimes, all these variants are present.

    When we use findFunction to look for these different names, , there's
    always a match, but in all cases it matches with "mpi_init__" (2
    underscores). For example:

       found_funcs.clear();
       if (appImage->findFunction ("mpi_init", found_funcs) != NULL)
       {
          fprintf(stderr, "match %s\n",
    found_funcs[0]->getName().c_str());
       }

    This results in finding "mpi_init__".

    We use this to discover dynamically the name mangling scheme that was
    applied by the compiler, and since all these searches end up matching
    with the symbol with 2 underscores, it's misleading for us.

    The particularity with these symbols is that they're defined as
    weak. Is
    this the expected behavior of the search when the symbols are
    weak? Or
    maybe we're doing something wrong?

    Thanks!
    -- G.


    http://bsc.es/disclaimer
    _______________________________________________
    Dyninst-api mailing list
    Dyninst-api@cs.wisc.edu <mailto:Dyninst-api@cs.wisc.edu>
    https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api




http://bsc.es/disclaimer
_______________________________________________
Dyninst-api mailing list
Dyninst-api@cs.wisc.edu
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api

Reply via email to