Hi,

  Forgive me if this is expected. I am probably abusing dlsym
behavior on other systems.

(gdb) p sprintf
$1 = {<text variable, no debug info>} 0x10044b300 <sprintf>
(gdb) p (void*)dlsym(NULL, "sprintf")
$2 = (void *) 0x7708a738 <sprintf>

  The test driver I use for http://www.gnu.org/software/lightning
calls dlsym in its pseudo assembler to resolve address of
functions.

  If using dlsym in the above example, it will return the address
of some function that does not handle float arguments, and
%f format will just print "f".

(gdb) x/i sprintf
   0x10044b300 <sprintf>:
    jmpq   *0x16026(%rip)        # 0x10046132c <__imp_sprintf>
(gdb) x/i 0x7708a738
   0x7708a738 <sprintf>:        mov    %rsp,%rax

  Since dlsym is only used to write test cases, at first I should
use a pseudo patch like this:

---%<---
#if __CYGWIN__
        /* FIXME kludge to pass varargs test case, otherwise,
         * will not print/scan float values */
        if (strcmp(parser.string + 1, "sprintf") == 0)
            value = sprintf;
        else if (strcmp(parser.string + 1, "sscanf") == 0)
            value = sscanf;
        else
#endif
        {
            value = dlsym(DL_HANDLE, parser.string + 1);
            if ((string = dlerror()))
                error("%s", string);
        }
---%<---

Thanks,
Paulo

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to