Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7072

Can't step into printf() function GDB. WSL2 Ubuntu 24.04

$
0
0

I'm currently running wsl2 ubuntu 24.04. I want to view the definition of the printf() function in GDB ( gdb ./main). But when I type the step command into printf(). It show this:enter image description here

GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-gitCopyright (C) 2024 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.Type "show copying" and "show warranty" for details.This GDB was configured as "x86_64-linux-gnu".Type "show configuration" for configuration details.For bug reporting instructions, please see:<https://www.gnu.org/software/gdb/bugs/>.Find the GDB manual and other documentation resources online at:<http://www.gnu.org/software/gdb/documentation/>.For help, type "help".Type "apropos word" to search for commands related to "word"...Reading symbols from ./main...(gdb) startTemporary breakpoint 1 at 0x1151: file main.c, line 5.Starting program: /home/mak/C/mainThis GDB supports auto-downloading debuginfo from the following URLs:<https://debuginfod.ubuntu.com>Enable debuginfod for this session? (y or [n]) yDebuginfod has been enabled.To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.[Thread debugging using libthread_db enabled]Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".Temporary breakpoint 1, main () at main.c:55               printf("Hello World!\n");(gdb) stepDownload failed: Invalid argument.  Continuing without source file ./libio/./libio/ioputs.c.0x00007ffff7e2dbf8 in __GI__IO_puts (str=0x555555556004 "Hello World!") at ./libio/ioputs.c:35warning: 35     ./libio/ioputs.c: No such file or directory(gdb)

I wasn't really sure what was happening. It worked on my fedora41 when I was dualbooting window11/fedora.

This is my main.c file

#include <stdio.h>int main(void) {    printf("Hello World!\n");    return 0;}

Compiled it like this:

gcc -ggdb -O0 main.c -o main

I have also installed:

sudo apt install build-essential

Pasted this is my ~/.bashrc

export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com"

Can someone help me?

I have tried export DEBUGINFOD_URLS="https://debuginfod.ubuntu.com"Even reinstall my wsl2.


Viewing all articles
Browse latest Browse all 7072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>