j6t / kdbg

A Graphical Debugger Interface around GDB
GNU General Public License v2.0
95 stars 19 forks source link

Can not start debugging files without debugging symbols - "Run" is disabled #15

Open FalcoGer opened 4 years ago

FalcoGer commented 4 years ago

I compiled on Ubuntu Mate 20.04. I have no KDE environment but I tracked down the relevant packages and managed to compile this. I was able to run KDE programs fine in the past.

For reference those packages are:

Compiling works fine. However when I load an executable the I can not start it. This happens both with the maint branch and the master branch. version 3.0.1. gdb on it's own works fine. The program I tested this with did not have debug symbols included. When I tested the same program with symbols I was able to run it.

Why can I not debug assembler?

image

After reloading the executable again I got this error message:

Could not start debugger Process. Please shut down KDbg and resolve the problem.

image

There is no information anywhere on how to "resolve the problem".

j6t commented 4 years ago

To track down the problem, run

kdbg -t /tmp/gdb-transcript myproggy

and then inspect /tmp/gdb-transcript. Perhaps it contains any hints about what is wrong.

Petross404 commented 2 years ago

This is what I found inside the tmp file:

set editing off
set confirm off
set print static-members off
set print asm-demangle on
set print thread-events off
set auto-load python off
set python print-stack none
set unwindonsignal on
define kdbg__alllocals
info locals
info args
end
define kdbg_infolinemain
list
info line
end
show endian
set prompt (kdbg)
GNU gdb (GDB) 11.1
Copyright (C) 2021 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-apple-darwin19.6.0".
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".
(gdb) (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) (gdb) >>>(gdb) >>>(gdb) The target endianness is set automatically (currently little endian).
(gdb) (kdbg)tty /dev/ttys004
(kdbg)file "t"
Reading symbols from t...
(No debugging symbols found in t)
(kdbg)info target
Symbols from "t".
Local exec file:
    't', file type mach-o-x86-64.
    Entry point: 0x100003f60
    0x0000000100003f60 - 0x0000000100003f8a is .text
    0x0000000100003f8a - 0x0000000100003f90 is __TEXT.__stubs
    0x0000000100003f90 - 0x0000000100003faa is __TEXT.__stub_helper
    0x0000000100003faa - 0x0000000100003fae is .cstring
    0x0000000100003fb0 - 0x0000000100003ff8 is __TEXT.__unwind_info
    0x0000000100004000 - 0x0000000100004008 is __DATA_CONST.__got
    0x0000000100008000 - 0x0000000100008008 is __DATA.__la_symbol_ptr
    0x0000000100008008 - 0x0000000100008010 is .data
(kdbg)quit
Petross404 commented 2 years ago

Info target command returns the start and end of .text section. I am thinking I should filter these two strings, convert them to hexadecimal and use list start, end to the sourcewnd. That means that the current GdbDriver::parseInfoTarget will be bigger and do more things than just filtering the Architecture.

I will post a small snippet when I have a working example.

What are your thoughts on this subject?

j6t commented 2 years ago

I don't understand what info target has to do with the original problem that GDB could not be started in the first place and that the Run command is disabled. Please explain.

Petross404 commented 2 years ago

Now that you are mentioning this, not only the debugger can't get started but the assembly listing isn't visible too. Are they related? If I list the disassembly from the aforementioned start to finish address, will one be able to place a breakpoint and run gdb?

j6t commented 2 years ago

When GDB was not started, nothing can work. So, please explain why you have a dump of GDB commands at all. Is it wrong that GDB did not run? Did it actually start?

Please confirm that you can reproduce the problem mentioned in this ticket. Otherwise, I simply do not understand what all you have said so far has any relevance to the topic.

Petross404 commented 2 years ago

I can't understand how is gdb not running but gdb can run commands and dumb its output.

I got this in my terminal when I ran my modified parseInfoTarget:

kdbg % ./build/kdbg/kdbg.app/Contents/MacOS/kdbg 
QCommandLineParser: already having an option named "h"
QCommandLineParser: already having an option named "help-all"
QCommandLineParser: already having an option named "v"
Icon theme "breeze" not found.
QPainter::begin: Paint device returned engine == 0, type: 2
Symbols from "/Users/petros/t.debug".
Local exec file:
    `/Users/petros/t.debug', file type mach-o-x86-64.
    Entry point: 0x100003f50
    0x0000000100003f50 - 0x0000000100003f84 is .text
    0x0000000100003f84 - 0x0000000100003f8a is __TEXT.__stubs
    0x0000000100003f8c - 0x0000000100003fa6 is __TEXT.__stub_helper
    0x0000000100003fa6 - 0x0000000100003fb8 is .cstring
    0x0000000100003fb8 - 0x0000000100004000 is __TEXT.__unwind_info
    0x0000000100004000 - 0x0000000100004008 is __DATA_CONST.__got
    0x0000000100008000 - 0x0000000100008008 is __DATA.__la_symbol_ptr
    0x0000000100008008 - 0x0000000100008010 is .data

Symbols from "/Users/petros/t.nodebug".
Local exec file:
    `/Users/petros/t.nodebug', file type mach-o-x86-64.
    Entry point: 0x100003f50
    0x0000000100003f50 - 0x0000000100003f84 is .text
    0x0000000100003f84 - 0x0000000100003f8a is __TEXT.__stubs
    0x0000000100003f8c - 0x0000000100003fa6 is __TEXT.__stub_helper
    0x0000000100003fa6 - 0x0000000100003fb8 is .cstring
    0x0000000100003fb8 - 0x0000000100004000 is __TEXT.__unwind_info
    0x0000000100004000 - 0x0000000100004008 is __DATA_CONST.__got
    0x0000000100008000 - 0x0000000100008008 is __DATA.__la_symbol_ptr
    0x0000000100008008 - 0x0000000100008010 is .data

I think the names are selfexplenatory and as expected t.nodebug raised this message. I don't know why kdbg reports that gdb failed to start though.

j6t commented 2 years ago

I don't know why kdbg reports that gdb failed to start though.

The message happens when KDebugger::debugProgram returns false. There are two return false statements in the function. Please find out which one is taken. Then analyze back from there what goes wrong.

Strugglemeat commented 1 year ago

I have the same issue, any executable I open I'm greeted with the message

GDB: Reading symbols from /home/bankbank/src/test-kdbg/hello...

This GDB supports auto-downloading debuginfo from the following URLs: https://debuginfod.archlinux.org Debuginfod has been disabled. To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit. (No debugging symbols found in /home/bankbank/src/test-kdbg/hello)

I can't run or debug anything. I have GDB installed.