I’m trying to debug a game with gdb. The game runs in fullscreen and causes
a segmentation fault and then gives control back to gdb. However, since the
game is in fullscreen, the gdb session can’t be viewed. So, at this point I
did CTRL-ALT-F6 which blanks the screen and gives me a console to login
with. I do this and determine the PID of the game process and kill it. This
should remove the x-window the game was using and leave the gdb session
on my gnome-terminal. I then exit the console login, which leaves me at
a console login prompt.
Now is the problem. How do I return back to my gnome-terminal gdb
session, ie, how do I recover from my console login? Via email, somebody
informed me that CTRL-ALT-F9 works for him, but it does not for me. In
fact, I’ve tried CTRL-ALT-<every function key> and nothing works for me.
The only thing for me to do at this point is to kill the power.
Any ideas?
(BTW, the game must be debugged in fullscreen because the problem
goes away when not in fullscreen.)
On Fri, 18 Feb 2011 20:06:01 +0000, rderosier wrote:
> (BTW, the game must be debugged in fullscreen because the problem goes
> away when not in fullscreen.)
If it doesn’t crash on startup, try launching it, and then switch to the
console and connect gdb to the process using:
gdb --pid [pidnumber]
You could also do this over ssh from a remote system.
Another option would be to launch screen in a terminal window and then
launch the program from within screen (in my experience, if you start
screen in a terminal window, it’ll use the X display unless you unset the
DISPLAY variable). Then you could go to the console after the crash and
use:
screen -r -d
to reconnect to the screen session to view the gdb output.
> Ctrl+Alt+F7 will get you back… try it without the game running.
As I said in the original post, Ctrl+Alt+F7 did nothing. However,
since you asked me to “try it”, I did the following:
opened gnome-terminal
ctrl+alt+f6
at console login prompt did ctrl+alt+f7 and nothing happened
> Press ctrl+alt+backspace twice to restart the X server
I did this just in a gnome-terminal and my whole screen
blanked and blinked a couple of times and logged me out.
I was then presented a normal login window. I can see
how this keeps me from killing the power to recover, and
maybe that’s what you were trying to point out (and if
so, thanks for the info). Hopefully, this suggestion didn’t
have anything to do with trying to get me back to my
gdb session?
I haven’t tried your “Code” instructions yet and I’m afraid
to, thinking it will log me out again, and what you already
told me will do that. So, what’s the purpose of the “Code”
instructions. Will it get me back to my gdb session?
> Another option would be to launch screen in a terminal window and then
> launch the program from within screen (in my experience, if you start
> screen in a terminal window, it’ll use the X display unless you unset the
> DISPLAY variable). Then you could go to the console after the crash and
> use:
>
> screen -r -d
>
> to reconnect to the screen session to view the gdb output.
This worked in connecting me to my gdb session and finding out where
the sigsegv was coming from. THANKS!
But, again, I found myself still in a console login and no way to recover
from it without killing the power.
> ps -ef |grep vt
> or
> ps -ef |grep "/usr/bin/X"
> /CODE}
> will show you the vt (Virtual Terminal) it's running on.
I know you are trying to help me, and I REALLY appreciate that!
However, telling me to try F8 doesn't help when I've already stated
that NO function key with Ctrl-Alt works for me. (I did however try
Ctrl-Alt-F8 as you asked, and it did not work.) I don't understand
what you wanted me to do with the rest of what's above. But, I
did ps -ef | grep vt and it showed /usr/bin/Xorg ... tcp vt7 was
running on tty7 owned by root.
Again I found myself with no way to recover from the console, so
I tried your Ctrl-Alt-Backspace twice again, but this time it didn't
do anything.
> init 3
> init 5 && exit
So, I thought I would test your suggestion of executing the above code as root.
I logged out as myself and back in as root. As soon as I typed "init 3" the screen
changed to the normal openSUSE background that one sees when it reboots with
all the stuff on the left-hand side and the words "done" on the right-hand side.
And it left me at a login prompt. I logged in again as root which took me back to
the same console session that I had entered "init 3" (it was already on the screen).
So, I typed "init 5 && exit" and the screen blanked and actually took me back to
my login session where I ran gdb, but with all windows closed. So, this seems to
recover from a console login without the need to kill the power. However, this
behaved so oddly to me, that I tried it a second time and when I did Ctrl-Alt-F6,
it took me back to the same root console login with both "init 3" and "init 5 && exit"
still on the screen. ODD! Anyway, I type "init 3" again and we went on the same
journey as before. Is this the behavior you expected?
Thanks
Ron
Sorry, 1 computer 1 keyboard. However, for what it’s worth, I have an Apple Macintosh computer/keyboard.
I have my Intel Mac set up as a dual-boot system for Mac OS X and Linux.
On 02/18/2011 09:06 PM, rderosier wrote:
>
> I’ve tried CTRL-ALT-<every function key> and nothing works
hardware fault or bad/burned out keyboard controller module on the
motherboard/in the USB system…
try to sub in a known good keyboard…
–
DenverD
CAVEAT: http://is.gd/bpoMD
[NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
173.14.28 3D, Athlon 64 3000+]
“It is far easier to read, understand and follow the instructions than
to undo the problems caused by not.” DD 23 Jan 11
If you have a console login, you can log in as root and restart the PC with:
shutdown -r now
and you can shutdown the PC with
shutdown -h now
If one has console access there should be no need to “kill the power”. I know that does not solve your original problem, but statements that there is “no way to recover from a console login without killing the power” without more detail strikes me as a bit odd, especially when there is NO MENTION of the commands I noted.
What I meant to say/infer in my “no way to recover from a console login without killing the power”,
is that I KNEW of NO way to do so (I’m too new to Linux to know this info). In fact, nothing that’s
been posted to this string did I know beforehand. So, thanks to all who have contributed to my
knowledge base.
Typing Ctrl-alt-f7 or Ctrl-alt-f8 is THE way to return to the graphical
session, provided that it is running correctly. Antoher way is running the
command “chvt 7”.
If this doesn’t work, well, your system is broken or something. Try this
before testing your game, as the debugger and crashed game may interfere in
unknown ways.
So, use the command “screen” to get back your terminal and debug session.
Save your data, and then restart X again using “init 3; init 5” - anything
you had running there will be killed.
> still on the screen. ODD! Anyway, I type “init 3” again and we went on the same
> journey as before. Is this the behavior you expected?
Yes.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
> Typing Ctrl-alt-f7 or Ctrl-alt-f8 is THE way to return to the graphical
> session, provided that it is running correctly. Antoher way is running the
> command “chvt 7”.
On Sat, 19 Feb 2011 07:59:49 +0000, DenverD wrote:
> On 02/18/2011 09:06 PM, rderosier wrote:
>>
>> I’ve tried CTRL-ALT-<every function key> and nothing works
>
> hardware fault or bad/burned out keyboard controller module on the
> motherboard/in the USB system…
>
> try to sub in a known good keyboard…
He said that he can get to a terminal console, so it seems that it’s not
hardware, but something blowing the X server out of the water.
On 2011-02-19 21:41, Jim Henderson wrote:
> On Sat, 19 Feb 2011 07:59:49 +0000, DenverD wrote:
>> try to sub in a known good keyboard…
>
> He said that he can get to a terminal console, so it seems that it’s not
> hardware, but something blowing the X server out of the water.
I understand that it doesn’t work even before running the gdb session. And
I also that it is an Intel Mac. If that is so, he has an issue with the
keyboard, hardware or software.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
On Sat, 19 Feb 2011 21:03:06 +0000, Carlos E. R. wrote:
> On 2011-02-19 21:41, Jim Henderson wrote:
>> On Sat, 19 Feb 2011 07:59:49 +0000, DenverD wrote:
>
>>> try to sub in a known good keyboard…
>>
>> He said that he can get to a terminal console, so it seems that it’s
>> not hardware, but something blowing the X server out of the water.
>
> I understand that it doesn’t work even before running the gdb session.
> And I also that it is an Intel Mac. If that is so, he has an issue with
> the keyboard, hardware or software.
He said he hits CTRL+ALT+F6 and gets a console login prompt, so it seems
that the switch in VTs is working OK to me…
On 2011-02-19 22:19, Jim Henderson wrote:
> On Sat, 19 Feb 2011 21:03:06 +0000, Carlos E. R. wrote:
>> I understand that it doesn’t work even before running the gdb session.
>> And I also that it is an Intel Mac. If that is so, he has an issue with
>> the keyboard, hardware or software.
>
> He said he hits CTRL+ALT+F6 and gets a console login prompt, so it seems
> that the switch in VTs is working OK to me…
But not to VT 7 or 8. However, the command “chvt 7” works, so X is not
dead, it is the keyboard which doesn’t work.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
I’m only guessing here, but I think it might be because of using an Apple computer/keyboard.
The keyboard F7 key has the fast-reverse symbol for when playing iTunes, and the F8 key
has the pause/play symbols. So, maybe Apple dedicates those keys for those functions.