newlib functions

kima2001
Posts: 2
Joined: Fri Apr 26, 2019 4:30 pm

newlib functions

Postby kima2001 » Fri Apr 26, 2019 4:47 pm

I am trying for a while now to find out how to include newlib functions in my gdb debug session but in vain.

when i step into printf function for instance, i only get the file name and the line number like "../../../newlib/libc/stdio/puts.c " : line 15
Anyone know how to step into newlib function trough gdb ?

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: newlib functions

Postby Ritesh » Sun Apr 28, 2019 9:34 am

kima2001 wrote:
Fri Apr 26, 2019 4:47 pm
I am trying for a while now to find out how to include newlib functions in my gdb debug session but in vain.

when i step into printf function for instance, i only get the file name and the line number like "../../../newlib/libc/stdio/puts.c " : line 15
Anyone know how to step into newlib function trough gdb ?
Hi,

Would you please describe your issue into details with steps which you are performing and what issue you are facing?

So that we can help you in terms of GDB debugging as per your requirement.
Regards,
Ritesh Prajapati

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: newlib functions

Postby ESP_Angus » Sun Apr 28, 2019 11:48 pm

kima2001 wrote:
Fri Apr 26, 2019 4:47 pm
I am trying for a while now to find out how to include newlib functions in my gdb debug session but in vain.

when i step into printf function for instance, i only get the file name and the line number like "../../../newlib/libc/stdio/puts.c " : line 15
Anyone know how to step into newlib function trough gdb ?
The newlib libraries for ESP32 are either compiled into ROM, or pre-built in the "newlib/lib/libc.a" and related files. The source code is available, but because the library was pre-built there is no matching source code available locally for gdb to step into (the source file paths in the library's debug info don't match anything on your local computer, because the library was built on a different computer).

For newlib functions with debug info available (like the one in your post), it is possible to tell gdb to substitute the path in the debug info for the correct path on your local computer, by using the gdb substitute path feature. FWIW, I've always found this to be reasonably fiddly and I mostly end up looking up the source code manually. But it is possible.

For newlib code which resides in ROM, there isn't full debug info available so unfortunately there isn't any easy way to have gdb show the matching source.

kima2001
Posts: 2
Joined: Fri Apr 26, 2019 4:30 pm

Re: newlib functions

Postby kima2001 » Sun May 05, 2019 5:17 am

Hi ESP_Angus,

i will check your solution later when i m back to my project. And i hope it will work well for me.
Nonetheless, Thank you ;) .

Who is online

Users browsing this forum: No registered users and 132 guests