Re: Question regarding debugging with gdb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



JT wrote on 2021/12/28 23:22:
I didn't find the BT that helpful... Although it's possible I've completely
forgotten everything I previously knew about gdb and I need to relearn
everything from the ground up.
I'm perplexed by the BT because the first of the steps it shows on the way
to the segfault is for main.cpp:79.

(gdb) bt
#0  xcb_get_setup (c=0x0) at
/usr/src/debug/libxcb-1.13.1-7.fc34.x86_64/src/xcb_conn.c:314
#1  0x00007ffff7f77bd0 in xcb_ewmh_init_atoms (c=<optimized out>,
ewmh=0x756540) at
/usr/src/debug/xcb-util-wm-0.4.1-20.fc34.x86_64/ewmh/ewmh.c:605
#2  0x000000000048db12 in LXCB::LXCB (this=this@entry=0x756540) at
../libLumina/LuminaX11.cpp:44
#3  0x00000000004ab991 in LSession::LSession (this=this@entry=0x7fffffffd9e0,
argc=@0x7fffffffd9ac: 1, argv=argv@entry=0x7fffffffdc18) at LSession.cpp:60
#4  0x0000000000445555 in main (argc=<optimized out>,
argv=0x7fffffffdc18) at main.cpp:79

Looks like this is QX11Info::connection() here:
https://github.com/lumina-desktop/lumina/blob/master/src-qt5/core/libLumina/LuminaX11.cpp#L44
(see #2) is returning nullptr and it ends up with null pointer dereference (see #0: c=0x0)

Regards,
Mamoru


OK Great, except the main.cpp of the program I'm debugging only has 27
lines.
https://github.com/lumina-desktop/lumina/blob/master/src-qt5/desktop-utils/lumina-screenshot/main.cpp
So I'm guessing that's a differnet main, and thus I need to figure out how
I get from the main in the utility I'm running to whatever that main is.

This is why I was hoping I could just dump everything to a file and then
walk the entire process step by step.  Yes I know I'd get a ton of info I
dont need, but at least then I dont have any questions as to what led to
what.

Thanks for the info, I'll see if I glean anything from the links you posted.

On Tue, Dec 28, 2021 at 8:48 AM Ben Beasley <code@xxxxxxxxxxxxxxxxxx> wrote:

Is the backtrace not helpful in figuring out where to set up
breakpoints? As in, “gdb foo”, then “run”, wait for the crash, and type
“bt”?

The darktable development documentation suggests[1] the following to log
useful backtraces:

     |$ gdb darktable ... crash dt here ... (gdb) set pagination off
     (gdb) set logging file gdb.txt (gdb) set logging on (gdb) thread
     apply all bt full|

If you need to do this non-interactively, you can combine it with gdb’s
batch mode. Strangely, I have a spec file that demonstrates this [2].
The debugbreak package is a header-only C library that implements
programmatic breakpoints, so the natural way to test it is with the
debugger.

Hopefully some of that is helpful.

– Ben

[1] https://www.darktable.org/development/

[2]

https://src.fedoraproject.org/rpms/debugbreak/blob/e009ccfac2b8e05a6018921ed6d3e732837a9e52/f/debugbreak.spec#_62

On 12/28/21 08:08, JT wrote:
Hey all,
I havent used gdb in a while, so I'm trying to knock the rust off my
knowledge and pick up a few more skills.
I'm trying to track down an issue in the Lumina Desktop. One of the
utilities (lumina-screenshot) segfaults when starting up and I'm
trying to deduce why.  The problem is that it gets pretty far into the
program starting before it finally dies and I havent been able to step
through gdb enough manually to find that point.

Is there a way to run gdb in a capture mode of some kind and dump the
output entirely like I can do with strace?
I kinda need to know where it's crashing to have an idea of where to
set up breakpoints.

Unless my memory is off, I was sure there was a way to do this but I
just can't seem to remember or figure out how to do it.

Any pointers?  Thanks!

JT

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it:
https://pagure.io/fedora-infrastructure



_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux