lightsoff in gdb

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

lightsoff in gdb

Postby marja » Sep 18th, '11, 12:12

I don't yet manage to see how I can run lightsoff inside gdb. I only want to, because I want to learn more about how to get backtraces.
(It's a known bug https://bugs.mageia.org/show_bug.cgi?id=1078 and AL13N is already working on a patch)

Is the information I need in this line from lightsoff.strace:
Code: Select all
6447  execve("/usr/bin/env", ["/usr/bin/env", "seed", "/usr/share/gnome-games/lightsoff"...], [/* 80 vars */]) = 0
? 6447 was a child PID and the one that segfaulted. If this is the needed info, how do I use it with gdb?

Or was this information I need already in here:
Code: Select all
[marja@DenkBlok2 ~]$ lightsoff
/usr/bin/lightsoff: regel 4: 10694 Segmentatiefout         /usr/bin/env seed /usr/share/gnome-games/lightsoff/main.js
[marja@DenkBlok2 ~]$


BTW, I did install gnomes-games-debug

Code: Select all
[marja@DenkBlok2 ~]$ rpm -qf --qf "%{SOURCERPM}\n" /usr/bin/lightsoff | sed 's/-[^-]*-[^-]*$/-debug/'
gnome-games-debug
[marja@DenkBlok2 ~]$
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50

Re: lightsoff in gdb

Postby dubigrasu » Sep 18th, '11, 12:31

I would try something like:
Code: Select all
gdb lightsoff
or eventually in the same directory where the executable is located:
Code: Select all
gdb ./lightsoff


at the gdb prompt type:
Code: Select all
run

and after the segfault type:
Code: Select all
backtrace full
User avatar
dubigrasu
 
Posts: 258
Joined: Apr 27th, '11, 22:34

Re: lightsoff in gdb

Postby marja » Sep 18th, '11, 15:36

Thx for answering, but I tried that before and that doesn't work:

Code: Select all
[marja@DenkBlok2 ~]$ gdb lightsoff
GNU gdb (GDB) 7.1-6.mga1 (Mageia release 1)
Copyright (C) 2010 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-mageia-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
"/usr/bin/lightsoff": not in executable format: File format not recognized
(gdb) Quit


/usr/bin/lightsoff is a shellscript:
Code: Select all
#!/usr/bin/env sh

export LD_LIBRARY_PATH="/usr/lib64/gnome-games${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
/usr/bin/env seed /usr/share/gnome-games/lightsoff/main.js


and when you look in the folder /usr/share/gnome-games/lightsoff/ you see a lot of javascript files.
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50

Re: lightsoff in gdb

Postby doktor5000 » Sep 18th, '11, 18:19

Well lightsoff, as you have experienced, is no good start to learn using GDB :(

BTW: If you experience errors, and want to provide the error messages to someone else
trying to help you, it's generally best to run every command prefixed by LC_ALL=C.
This sets C locale, so every output will not be localised in you systems current locale (language)
but in english, which is easier or more helpful to developers.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18015
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: lightsoff in gdb

Postby marja » Sep 18th, '11, 19:57

2x thanks

I'm often not aware that it's better to stop trying something, so thanks for concluding that lightsoff isn't a good start to learn to use GDB. You're right!
And I wasn't aware that the code was partially in Dutch, I even had to edit another post twice today, because two seperate lines that I had written turned out to be in Dutch :o
I guess I was too much in a party mood because of Mageia's first birthday :lol:
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50

Re: lightsoff in gdb

Postby doktor5000 » Sep 18th, '11, 20:54

No problem for me :)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18015
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: lightsoff in gdb

Postby doktor5000 » Sep 19th, '11, 14:36

Because i needed to use gdb myself now, actually for the first time, here's a good step-by-step guide to do this:
http://www.thegeekstuff.com/2010/03/deb ... using-gdb/
*hint* Look for the middle part of the headline of that page, see what i mean ;)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18015
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: lightsoff in gdb

Postby marja » Sep 20th, '11, 09:57

C Program

Apparently, the best way to start to know GDB, is try it on a program written in C

Here http://www.gnu.org/software/gdb/download/ANNOUNCEMENT I read GDB is a source-level debugger for Ada, C, C++, Objective-C,
Pascal and many other languages.

If it would be both possible and easy to use it on Java Script, I guess Java Script would be in the list.
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50

Re: lightsoff in gdb

Postby doktor5000 » Sep 20th, '11, 10:25

Exactly.
Maybe you want to try valgrind?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18015
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: lightsoff in gdb

Postby marja » Sep 20th, '11, 13:15

doktor5000 wrote:Maybe you want to try valgrind?


Good idea. Of course, I shouldn't start trying it with lightsoff, but I did anyway. At first I got this weird message
Code: Select all
valgrind Warning: Can't execute setuid/setgid executable:
that disappeared after I had changed the permissions for /usr/bin/lightsoff from 555 (that should have been enough permission, shouldn't it?) to 777. Later, when I changed them back to 555, the message didn't come back, Valgrind just kept working. It gives an enormous amount of output, though, so I couldn't scroll back to the beginning. Putting
Code: Select all
| less
behind the command string didn't work: the output disappeared the moment I tried to scroll through it.

And when I try
Code: Select all
valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --trace-children=yes ./lightsoff | tee /home/marja/valgrindlightsoff.txt
or
Code: Select all
valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --trace-children=yes ./lightsoff > /home/marja/valgrindlightsoff2.txt
I only create empty textfiles. :(
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50

Re: lightsoff in gdb

Postby marja » Sep 20th, '11, 13:20

But putting 2 before > works!
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50

Re: lightsoff in gdb

Postby marja » Sep 20th, '11, 13:23

Code: Select all
[marja@DenkBlok2 bin]$ valgrind -v --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --trace-children=yes ./lightsoff 2> /home/marja/valgrindlightsoff3.txt
[marja@DenkBlok2 bin]$


Now the file isn't empty anymore, but contains 84,516 lines of text :D
User avatar
marja
 
Posts: 546
Joined: Aug 22nd, '11, 20:50


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest