enable breakpoint while debugging user input (gdb/linux) - linux

Recently I've been running into a problem where I want to enable a break-point in the middle of being in an interactive application (keyboard and mouse - dragging modal UI elements).
I want to be able to enable a break point once the application is already running and in the state I want.
The ability to ignore the breakpoint N times, can work - but dealing with mouse motion its a hassle to get right (not very predictable).
Ideally I could have a 3rd device (I joystick button of foot pedal for example), and press it when I want to enable the breakpoint.
Another option could be to SSH into my system from a second system and enable the breakpoint this way.
Is anyone aware of some good ways to interactively enable enable breakpoints while the application runs?

When debugging an interactive X11 application, running the debugger from a separate workstation was pretty much a requirement ... until introduction of Xvfb.
These (running debugger from a separate workstation or running the app in Xvfb) are pretty much your two plausible choices.

Related

Does a window need a graphical environment to exist?

This one is a pretty strange question of mine so I'll try to explain the best I can.
On a DOS Linux distribution, without having installed any graphical environment, if I start an application which is supposed to have a GUI, will I be able to interact with that window via code?
What I thought is that if KDE/GNOME's role is to graphically represent an existing GUI, I should be able to interact with it but if these graphical environments have an active role in the window creation there is nothing I can do.
You won't be able to run a graphical program without a window manager.
The reason is that the window manager is doing a lot more than just allowing the window to be shown to the user. It comes with libraries and services for constructing windows and components and interacting with them. Without these libraries and services, the program won't be able to start.
The only exception would be if a program contained all the graphical code built into it, and didn't rely on a window manager. Realistically this would only happen for a fairly simple program and in special cases; for instance, Raspbian includes OMXPlayer, which shows full screen video without relying on any window manager.
Quoting (with some adaptation) from https://raspberrypi.stackexchange.com/a/3974 which answers how to start mplayer in X11 without a window manager:
The X server is really usually called X and you can just start it. You can set the DISPLAY number as an argument along with some other things.
You might want to have some sort of session, though, and still go through xinit or such and start X with startx. You can use .xinitrc or such as a script and simply not start a window manager there. You will need a "magic client" as the last command that stays running so X doesn't terminate immediately. In a traditional "failsafe" session, that was an xterm. If you know what to launch and launch once only, it could be that program or any UI/wrapper that does the launching for you. When the last ("magic") client in the init script terminates, X terminates.
If all you want to do is play video, you might see if you can run mplayer with directfb instead and skip using X11 entirely.

How to simultaneously run multiple window managers (esp. xmonad) for VNC

I'll start with a little background. A small project of mine has been to try to use my Android tablet as an external monitor for my laptop using a VNC client (vnc4server). There are two main options for doing this that I have seen. The simplest is to use xrandr and widen the screen, creating a section just for the tablet. However, this can cause some graphics issues if I understand correctly, although it has the benefit of permitting windows to cross displays. The other option is to run a separate desktop session for the VNC server.
I have chosen to go the route of a second desktop as the session can live and die without significantly affecting my main session and can in theory be tailored specifically to the tablet. A little tool called x2vnc allows me to connect to the VNC server in a similar manner to the more popular Synergy and use it like a n external monitor. I also have the nice little benefit of being able to easily and cleanly switch from landscape to portrait using xrandr.
This brings me to my current issue. So far, I have only been able to reliably use plain x-windows. Although this is entirely functional, I would prefer something more complete. Although xstartup examples have been posted for a variety of window managers, none of these seem to run properly. I suspect all of these are for headless systems. Gnome/Unity are each unforgivably slow and seem to conflict with my existing session. I also feel that these are a little too cluttered for my ten inch tablet. On the other hand, Xmonad simply crashes as soon as I try to open a second window in addition to not updating the graphics properly.
I would like to know anything that will lead me in the direction of a better stable desktop environment. This includes configuration tips and alternate window managers.
I am currently running Ubuntu 12.04 with gnome-xmonad (recently Unity). My xstartup is plain x-window-manager. I have tried any readily available examples for gnome and xmonad that I have been able to find.

is there a way to pause gnome from other tty?

To run a virtual machine on my computer and to have more resources for it, I'd like to pause gnome. The idea is to go on other tty pause gnome from it and run my virtual machine with lower ram for the host than necessary with the use of gnome.
I did not found anything, I supposed it is not possible. But I'd like to be sure. That's why I ask the question here
My OS is linux mint 13.
Have a good day.
There isn't any way currently to freeze a process to disk on Linux and remove it from RAM, and even if there was, what you call GNOME is made up of many processes and programs that are all running at the same time so trying to co-ordinate what processes you needed to freeze would be tricky
If you want to have more resources for your VM, you could sign out of Gnome and use another Desktop Environment while you use the virtual machine. If you used window maker you would save hundreds of megabytes of ram. Window Maker only uses a few megabytes, and takes very little disk space.
If you do use Window Maker, then it is a little confusing at first. To access your applications, right click on the desktop, to get a menu. There is an application dock on the side of the screen, but by default it only holds an xterm launcher.
If your application is not in the applications menu, then you will need to start it using xterm. When is icon appears, drag it to the dock, and you will be able to launch it from there. To edit the application menu you need to right click on the desktop and select Configure Window Maker.

Restrict keyboard short-cuts in x11vnc

How can I restrict keyboard shortcut options in x11vnc?
for example, I want to restrict Alt+F4, Alt+x, Ctrl+Q, etc.
Is -skip_keycodes option of any help here?
You can probably configure such shortcuts in your window manager. That way, such shortcuts won't be passed to the application, and you should be able to handle them.
But, since you seem to want an application running all the time (you want to prevent users from closing it), then it might be a good idea to write a simple script like this:
while true; do run_your_application ; done
That way, if the application crashes or is closed, it is restarted. (be careful about applications that fork themselves or detach from the terminal!)
On the other hand, if you just want a browser, you can try using the kiosk mode from Opera browser. See also kiosk software at Wikipedia.
Update: So you are using Gnome... I don't use Gnome, but a quick search at SuperUser gave me this answer:
https://superuser.com/questions/132666/how-to-disable-control-alt-arrow-gnome-window-manager-control-for-redhat-linux
[…] all the keyboard shortcuts gnome uses are under System, Preferences, Keyboard shortcuts.
But... Are you sure you want a Gnome environment running there? Do you really want users to be able to run and configure anything from your Gnome interface? Maybe you would prefer another more minimalistic Window Manager. Which one? I'm not sure, must look what are the alternatives and try some of them. Depending on the application, it might even be possible to run it with no window manager at all.
I don't what kind of problem you are trying to solve, but maybe using a VNC applet in a webpage in order to have access to one application might not be the best solution. Of course, it depends on what is the problem and who are the users.

How to start a gtk application after booting up without logging in?

I have got a gtk application. I want it to start automatically when I boot up the system, such that instead of getting usual login screen, my application greets the user.
My application is a sort of cash dispensing application. So user should not even see the login screen of linux. Whenever machine in boot up, after loading services and all that, my application should appear on the screen. One should not have to put any password or login in anyway to start that application.
Now so far I have tried the following but all in vain.
I put the command in my /etc/rc.local file
/home/EXE/cashier
Then rebooted machine in run level 5. But nothing happens. I get the usual login screen. Other programs that do not involve any gui or gtk, they are automatically started in this manner but not the gtk application.
Then I put
xint /home/EXE/cahier
and later
xint /home/EXE/./cashier
But they too didn't work. When I looked into details, I found out that "An Xserver is already running on screen 0, cannot open other server" or something like that.
Then I tried booting into run level 3, this time it worked.
xint /home/EXE/.cachier
But in run level 3, the font and icon sizes are smaller. Moreover some windows do not cover the whole screen.
Now I will really appreciate a way to run my application in run level 5, without showing login screen automatically.
Regards
Edit
Currently, the application is running on fedora core 2
This is more a question about linux distribution startup than it is about Gtk applications. The specifics are going to depend on your distribution, but the essence is:
Disable the gdm facility, which is normally responsible for spawning your X server.
Run xinit (not "xint") to start the server manually. This takes a client as its argument. It may work to run your Gtk application directly (it needs to be smart enough to position and size itself instead of relying on a window manager), but more likely you will want to pick a window manager to run it in. The easiest way to do this is via script that you pass to xinit.

Resources