Debug printf source code with gdb on ubuntu

Source: Internet
Author: User

Debugging printf source code with gdb on ubuntu by default, the library function does not contain debugging information, so gdb cannot be used to enter the printf () function. Www.2cto.com solution: 1. install libc: sudo apt-get install libc6-dbg with debugging information 2. download libc source code. select a directory to place the source code and enter, such as/home/kent/dev-OS/libc6-source B. run sudo apt-get source libc6 to download the source code to the current directory.
The last source directory is probably:/home/kent/dev-OS/libc6-source/eglibc-2.15 www.2cto.com 3. specify the libc source directory when running gdb: gdb 'Find/home/kent/dev-OS/libc6-source/eglibc-2.15-type d-printf'-d % P' my_program 4. enter the printf () function. the first line of code I see here is va_list arg;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.