gdb

Permission denied when opening a file in gdb

Permission denied when opening a file in gdb I’m implementing some CTF challenges. The flags are in some text files, that get read from the programs. To protect the flags I have changed the owner of the files, but have set the setuid to the executables to be able to read the files. It works …

Total answers: 1

How can I break at module_init()? This loadable kernel module is preventing SSH logins

How can I break at module_init()? This loadable kernel module is preventing SSH logins I am porting the driver for a USB device to Rocky Linux 9.3. Once the module is inserted, new logins by ssh are unresponsive. Blacklisting the module and rebooting restores normal functionality. https://github.com/izot/lon-driver With the module inserted, lsmod|grep u50 "Used By" …

Total answers: 1

gdb print out a pointer is null or not

gdb print out a pointer is null or not source:https://git.postgresql.org/cgit/postgresql.git/tree/src/backend/optimizer/plan/planner.c (gdb) n 3556 if (root->group_pathkeys) (gdb) s 3558 else if (root->window_pathkeys) (gdb) print root->group_pathkeys==NULL No symbol "NULL" in current context. (gdb) s 3559 root->query_pathkeys = root->window_pathkeys; (gdb) s query_planner (root=root@entry=0x55ffb53fdb70, qp_callback=qp_callback@entry=0x55ffb3299ee0 <standard_qp_callback>, qp_extra=qp_extra@entry=0x7ffc5db45260) at ../../Desktop/pg_sources/main/postgres/src/backend/optimizer/plan/planmain.c:219 219 fix_placeholder_input_needed_levels(root); based on above I can guess root->group_pathkeys == …

Total answers: 1

gdb execute through to a specific function

gdb execute through to a specific function https://git.postgresql.org/cgit/postgresql.git/tree/src/test/modules/delay_execution/delay_execution.c https://stackoverflow.com/questions/11967440/stepping-into-specific-function-in-gdb I loaded the module delay_execution. then gdb -p $proc quite new to gdb. can I let gdb execute directly up to the beginning of delay_execution_planner? there are many steps, press step by step seems not so good. Asked By: jian || Source That’s what breakpoints are …

Total answers: 1

How to debug (gdb) a binary that is invoked with xvfb-run?

How to debug (gdb) a binary that is invoked with xvfb-run? I have a binary that I usually run as follows: $ xvfb-run ./bin –param1 foo However, now that I need to debug it using GDB, I’m not able to do: $ gdb –args xvfb-run ./bin –param1 foo because "/usr/bin/xvfb-run": not in executable format: file …

Total answers: 1

How can I remotely debug linux module using GDB?

How can I remotely debug linux module using GDB? I searched all over the internet but couldn’t find proper steps to debug linux module remotely using gdb. I am tring qemu but facing many issues there. Is there any other tool that I can use or if not then can you provide me proper steps …

Total answers: 1

GDB fails to download debuginfo for math.h

GDB fails to download debuginfo for math.h I have a simple clock program that uses math.h functions. I am currently on Kubuntu 21.10, the GCC version is (Ubuntu 12.2.0-3ubuntu1) 12.2.0, and the GDB version is (Ubuntu 12.1-3ubuntu2) 12.1. The program source code (although it might not be needed): #include <stdio.h> #include <time.h> #include <math.h> #include …

Total answers: 1

Start GDB with No Help Information

Start GDB with No Help Information Every time I start gdb, the following information is displayed: GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2 Copyright (C) 2020 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 …

Total answers: 1

What does C@t{++} mean in the gdb man page?

What does C@t{++} mean in the gdb man page? I was reading the manpage for gdb and I came across the line: You can use GDB to debug programs written in C, C@t{++}, Fortran and Modula-2. The C@t{++} looks like a regex but I can’t seem to decode it. What does it mean? Asked By: …

Total answers: 2

How can I install "gdb-arm-none-eabi" on Ubuntu 18.04 (Bionic Beaver)?

How can I install "gdb-arm-none-eabi" on Ubuntu 18.04 (Bionic Beaver)? In previous versions of Ubuntu, GDB for ARM Cortex processors was part of the package gdb-arm-none-eabi. Searching https://packages.ubuntu.com/ for gdb-arm-none-eabi for Ubuntu 18.04 doesn’t return any results. Am I missing something or why isn’t there any GDB for ARM any more? Asked By: user1729210 || …

Total answers: 7

GDB step in delays

GDB step in delays I am making a nice presentation of ARM assembly code execution and I would need GDB to step the code every 1 second infinitely long (well until I press CTRL+C). Has anyone got solution? I don’t want to keep on standing next to the keyboard and stepping the program when visitors …

Total answers: 4

Why does GDB need the executable as well as the core dump?

Why does GDB need the executable as well as the core dump? I’m debugging using core dumps, and note that gdb needs you to supply the executable as well as the core dump. Why is this? If the core dump contains all the memory that the process uses, isn’t the executable contained within the core …

Total answers: 5

Elapsed time in gdb

Elapsed time in gdb Is there a way to measure elapsed time running the program under gdb? Look to this: <————bp———————————-> Assume that we are debugging a file and in some random place, we set a breakpoint. Now in gdb we perform something and then we let the program continue the execution by using the …

Total answers: 1

How to step-into, step-over and step-out with GDB?

How to step-into, step-over and step-out with GDB? I typed help while I was in the GDB but didn’t find anything about step-into, step-over and step-out. I put a breakpoint in an Assembly program in _start (break _start). Afterwards I typed next and it finished the debugging. I guess it was because it finished _start …

Total answers: 3

GDB throws error on Arch Linux

GDB throws error on Arch Linux When I try stepping through a program, gdb throws this error std::ostream::operator<< (this=0x6013c0 <std::cout@@GLIBCXX_3.4>, __n=2) at /build/gcc/src/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/ostream.tcc:110 110 /build/gcc/src/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/ostream.tcc: No such file or directory. This is the program I am trying to debug. #include <iostream> int printPrime(int, int); int main() { int t, c; std::cin >> t; c = …

Total answers: 2

How to save the result of printf to a variable in GDB?

How to save the result of printf to a variable in GDB? (gdb)printf “Hello %d”, 7 Hello 7 (gdb)set $MyVar = printf “Hello %d”, 7 // ??? How to save the result of printf “Hello %d”, 7 to $MyVar? Asked By: xmllmx || Source eval does a printf of its arguments and then runs it …

Total answers: 1

How to make gdb not ask me "y or n"?

How to make gdb not ask me "y or n"? When I use GDB command add-symbol-file to load the symbol, GDB always asks me ‘y or n’, like this: gdb> add-symbol-file mydrv.ko 0xa0070000 add symbol table from file “mydrv.ko” at .text_addr = 0xa0070000 (y or n) How to make it not ask and execute quietly? …

Total answers: 1