During usage of ConqueGDB I noticed that it sends following commands:
server backtrace
server break
server <anything>
I'm wondering what is the purpose of the server keyword here. Alone it returns:
Undefined command: "server". Try "help".
With other commands like those mentioned before it looks like the word is just ignored.
The server prefix can be used to prevent a command from being put into the command history, and to avoid having it be available for command repetition. This is useful for front ends that want to run some commands without interfering with whatever the user might be doing. This is documented in the manual.
Related
I have an adapter code which executes some specific commands on a Linux machine via SSH. It executes commands and handles the output of each command in a specified manner.
The issue being faced is very straightforward.
I am connecting to a Bash prompt that uses colors. Here are the details of the PS1 variable:
PS1="\[\033[1;34m\][\$(date +%H%M)][\u#\h:\w]$\[^[[0m}\]"
The code uses regex which decides a valid terminal first and then proceeds with the commands.
For example, .*\$ is considered valid
I can't seem to handle [^[[0m} properly and code is not able to identify the terminal as a valid one. If I remove it from PS1 variable, things work fine.
Can anyone please suggest what regular expressions might be entered so that the code takes it as a valid terminal?
I think the PS1 variable you provided above is broken.
I ran the following experiment in my terminal window:
[guest#localhost ~] $ export PS1="\\[\033[1;34m\\][\$(date +%H%M)][\u#\h:\w]$\\[^[[0m}\\]"
[2137][guest#localhost:~]$^[[0m}
As you can see ^[[0m} is not interpreted properly. I assume it is the end of the color in the prompt. I think it should be \\[\033[0m\\].
Here is the whole PS1 variable:
PS1="\\[\033[1;34m\\][\$(date +%H%M)][\u#\h:\w]$\\[\033[0m\\]"
After testing it you get this:
[2137][guest#localhost:~]$^[[0m}export PS1="\\[\033[1;34m\\][\$(date +%H%M)][\u#\h:\w]$\\[\033[0m\\]"
[2139][guest#localhost:~]$
I need to run this shell command in a C++ script:
"/usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so" -o "/usr/local/lib/output_http.so –w /usr/local/www" -b"
This command launches an application which broadcasts a video feed. When I execute this command via system() in C++ the application doesn't start properly.
I use:
system("/usr/local/bin/mjpg_streamer -i \"/usr/local/lib/input_uvc.so\" -o \"/usr/local/lib/output_http.so –w /usr/local/www\" -b");
When I try to access the video stream after I started it with the C++ application the webpage returns:
501: Not Implemented!
no www-folder configured
I can't expect you guys to give me an application related solution, but I'm wondering if there's a difference in the way commands from a C++ application using system() and commands directly entered in a terminal are executed.
EDIT: The application broadcasts the video stream on IP:8080. I access it by going to that IP in my browser. Usually it opens a webpage with the stream in it but when I execute the command with the C++ application I get that error.
Edit: The old idea of mis-placed quotes was wrong; I realize that -w is actually an option to output_http.so, so the whole shebang must be passed as a single parameter to the -o option, as shown here or here etc.
In that case, check file permissions etc. Does /usr/local/www exist? Is it possible that you are running the shell command from a root shell?
Hey, I have a book recommendation, too, "one of the best tech books ever published": Stevens' Advanced Programming in the Unix Environment. The guy knows -- sorry: knew -- what he was talking about.
I would avoid using the system(3) library function, or at the very least, check its returning error code. I don't understand why you are using " inside your command (I believe that in your particular case, you don't need them; but in general beware of code injection!). Read about globbing
You could use popen(3) to at least get the output of the command.
Even better, code yourself the running of the mjpg_streamer program using the fork(2) & execve(2) & waitpid(2) and other syscalls(2) (perhaps pipe(2), poll(2), dup2(2) etc...). Read Advanced Lnux Programming for more.
I'm adding some features I find useful to my GDB startup script. A few of the startup commands apply only to "live" targets, or have components that make sense only with live targets. I'd like to be able to test for the presence (or absence) of a core file, and skip or amend these commands as appropriate.
I looked around in the Python API, but couldn't find anything that tells me whether an inferior is a core file or a live program. I'm fine with a scripting solution that works in either GDB itself or in the Python GDB scripting interface.
It doesn't look like there is a way to do that.
I'd expect an attribute on gdb.Inferior, but there isn't one.
File a feature request in GDB bugzilla.
info proc status returns "unable to handle request" for core files, whereas for a live process it returns several lines, the first of which looks like: "process 1234".
You can run that command and compare its first output line against that string using the execute_output() function from here: https://github.com/crossbowerbt/GDB-Python-Utils/blob/master/gdb_utils.py
im using GDB to debug a C code in eclipse, and i wanted to ask a question about the GDB handling multiple commands.
if i send the GDB multiple commands through an external software for example:
im sending 'bt', and 'p counter', and than 'help'.
is it possible that the 'bt' command is taking too long to process and return an answer that the GDB will suspend the 'bt' command handling and will try to handle the next command?
it doe'snt make sense to me if it did, but it is important for me to know if it is possible.
i checked in google and i have read the gdb tutorial but never found explanation about the GDB handling commands that are sent to it.
thanks.
Check GDB Internals which talks about many important GDB operations and algorithms. If you have time it is good to dig deeper by looking at GDB source code to understand well.
I've just installed Pyclewn. It works and shows variables and etc. But it doesn't show my program's output and when my program wants to input something, it doesn't do anything(I can write ":C run output" and it works. but not with standard I/O.
There was something in its documentation: http://pyclewn.sourceforge.net/_static/pyclewn.html
But I didn't understand what it says.
P.S: I've done that. Now I want to map for example to run those commands. but because the "nn" in /dev/pts/nn may vary, I should manually enter the number(see it from the xterm opened). I also have another problem when I map a key to a sequence of gdb commands, it says gdb is busy, I can add ":sleep 100m" between commands and the problem will be soved. but in the documentation it says that I should enable async option. but when I run pyclewn from vim with :Pyclewn command I don't know how to enable the async option.
You should use inferior_tty.py to create a terminal to be used with the program being debugged.
Abridged summary (most relevant bits only) from the FAQ:
:Cshell setsid xterm -e inferior_tty.py &
Determine what the name of the tty to be used is from this newly spawned window, then:
:Cset inferior-tty /dev/pts/nn
Or just start pyclewn from a terminal and it will automatically grab that terminal for input and output.
E.g:
pyclewn -c "main.cc other.h other.cc"