This is the mail archive of the gdb-patches@sources.redhat.com 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]

New target method returning the name of the malloc function?


Hello,

The name of the function used to allocate some memory in the inferior is
currently hard-coded to "malloc" in valops.c:

     struct value *
     value_allocate_space_in_inferior (int len)
     {
       struct value *blocklen;
       struct value *val = find_function_in_inferior ("malloc");
                                                       ^^^^^^

Unfortunately, on interix, the malloc function is not always there.
Quoting Donn Terry:
<<
malloc() won't necessarily be present; the way our namespace pollution
prevention stuff works, if the user application doesn't call an entry
point at all, it just won't be there.  However, _malloc is always
present (at least in any real program) because it's called from within
the library.
>>

May I suggest a new architecture method called for instance
NAME_OF_MALLOC or MALLOC_FUNCTION_NAME? The default would be to return
"malloc", but we could then change it to "_malloc" for the interix
target.

-- 
Joel


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