I am trying to find all the places in a large and old code base where certain constructors or functions are called. In particular, these are certain constructors and member functions in the std::string
class (i.e. basic_string<char>
). For example, suppose a line of code exists:
std::string foo(fiddle->faddle(k, 9).snark);
In this example, it is not obvious that snark
might be char *
, which interests me.
Attempts to solve it so far
I looked at some functions of the gcc dump and generated some of them, but I could not find anyone who would tell me that this line of code would call a string
constructor takes a const char *
. I also compiled code with -s to save the generated equivalent assembly code. But this is due to two things: function names are "crippled", so it is impossible to know what is called in terms of C ++; and there are no line numbers, so even finding the equivalent location in the source file would not be easy.
Motivation and background.
In my project, we are moving a large old code base from HP-UX (and their aCC C ++ compiler) to RedHat Linux and gcc / g ++ v.4.8.5. The HP tool chain allowed you to initialize a string
with a NULL
pointer, treating it as an empty string. Generated Gnu tool code with some flavor of zero dereference error. Therefore, we need to find all possible options for this and fix them. (For example, adding code to check for NULL
and using the pointer to the string ""
instead.)
So, if someone there had to solve a basic problem and could offer other suggestions, this would also be welcome.
source share