Sysprogs forums › Forums › VisualGDB › USB CDC project scanf() redirection fails › Reply To: USB CDC project scanf() redirection fails
Hi,
Our newlib-nano build (gcc-arm-none-eabi-6-2017-q2-update) is configured with the following flags:
../newlib/configure --target=arm-eabi --prefix=/q/gnu/newlib-nano/newlib-nano-install --disable-newlib-supplied-syscalls --enable-newlib-reent-small --disable-newlib-fvwrite-in-streamio --disable-newlib-fseek-optimization --disable-newlib-wide-orient --enable-newlib-nano-malloc --disable-newlib-unbuf-stream-opt --enable-lite-exit --enable-newlib-global-atexit --disable-nls --enable-newlib-nano-formatted-io
The configuration process creates many header files with generated flags, so it’s hard to give a definitive answer. If you would like to look deeper into it, please consider building it from sources on your side and verify which version of the code is built by injecting #error directives into the source files.
Another (easier) option would be to try setting breakpoints in other functions that should be called (see the call stack below) until you pinpoint the one that is not called:
> _read() C++ (gdb) _read_r() C++ (gdb) __sread() C++ (gdb) __srefill_r() C++ (gdb) __svfscanf_r() C++ (gdb) scanf() C++ (gdb)
Here’s the program we tested it with:
extern "C" int _read() { asm("bkpt 255"); } int main(void) { int x; scanf("%x", &x); }