Top Forums Programming gdb: how to debug an executable file with a few command line papameters Post 302245750 by vino on Saturday 11th of October 2008 12:21:16 AM
Originally Posted by cdbug
If an executalbe file has several parameters, gdb can not pass parameters correctly. Let us see:

./executablefile1 agr1 arg2 arg3

gdb executablefile1
run executalbefile1 arg1 arg2 arg3

then argv[0] : executablefile1
argv[1] : executablefile
argv[2] : arg1
argv[3] : arg2
argv[4] : arg3

When we use argv[x] many times, it is unconvenient to change each to argv[x+1].

May we fix it in a tricky way?

Run it as
gdb executablefile
run arg1 arg2 arg3

Test Your Knowledge in Computers #352
Difficulty: Easy
Unix was created 25 years before Linux.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

gdb: problem while debug an executable file

I created one file (test.cpp)and complied it and get the executable file(test) and run it.It is giving the out put but when I am trying to debug that executable.I am getting the error -- please tell me the solutions?? Thanks in advance ..... (2 Replies)
Discussion started by: smartgupta
2 Replies

2. UNIX for Advanced & Expert Users

a question about debug using gdb(/lib32/ No such file or directory)

Hi all, (gdb) target remote Remote debugging using warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. 0x2fbd0800 in ?? () (gdb) l 1 ... (0 Replies)
Discussion started by: yanglei_fage
0 Replies

3. Programming

Debug two process Using GDB

Hi All I know How to attach a process to beubg it .But for my application I am using client as well server.Both are two separate process .Suppose I need to debug both .How to attach both of them together .Or I have to attach them separetly . Suppose client process id is 1325 and server is... (2 Replies)
Discussion started by: mr_deb
2 Replies

4. UNIX for Dummies Questions & Answers

running command prompt executable file in shell script

hi i have file extentioned with test.vbs. i am able to run this file n execute through command promt but i dont know how to run in shell script example: file name is test.vbs which contains strSoundFile = "C:\windows\Media\Notify.wav" Set objShell = CreateObject("Wscript.Shell") strCommand... (5 Replies)
Discussion started by: atl@mav
5 Replies

5. Shell Programming and Scripting

How to compile or debug line by line in shell script?

I know about bash -x, set -x and -v but disappears from Command Line Interface in fraction of second ...... I am looking for a command or script ..complies each line and shows the output after executing each line ....( similar what we have in C ) Thanks in Advance (2 Replies)
Discussion started by: frintocf
2 Replies

6. Programming

GDB No line in file error

Hi, I have a c program i compile with gcc4.5. This elf, if I use gdb and put a breakpoint on main, instead has a breakpoint in a function other than main or says no line in file. I verified the elf is 1 to 1 with source, have all debug symbols for compilation etc. The problem I think is the... (2 Replies)
Discussion started by: dragonpoint
2 Replies

7. Programming

Can't debug: assert error with gdb (no problem without)

I'm sorry if the title is really criptic, but I don't know how to phrase my problem. I know I can't really ask for a solution, and I normally wouldn't but this is really escaping my abilities. Antefacts. I developed a program using the zeromq messaging library. I got to a point where the... (11 Replies)
Discussion started by: erupter
11 Replies

8. UNIX for Dummies Questions & Answers

GDB not showing line details

I have bunch of source code which I compiled using -ggdb3 flag. I have copied the source code and executable to an another machine. When I run the exe in gdb it does not show the statments at the line numbers when it breaks. This is what I see Breakpoint 1, TestCode (handler=0x806e110,... (1 Reply)
Discussion started by: rupeshkp728
1 Replies

9. AIX

Gdb on a 64 bit executable - cannot access memory

Hi, Can anyone explain this please..... A simple test program... ### snip #include <stdio.h> main() { static int n; n = 6; printf("hello %d\n", n); n=7; } ### snip 64 bit compile/link.... (2 Replies)
Discussion started by: bagpussnz
2 Replies

10. Programming

Odd behavior from GDB while trying to cross-debug an embedded Linux application.

Some background: The application normally runs on an embedded platform. Currently, for development purposes, I have the rootfs located @ /exports and the target is communicating over NFS. That way I can make a change on my local system, save the application @ /exports, and run the altered... (4 Replies)
Discussion started by: Circuits
4 Replies
GZEXE(1)						      General Commands Manual							  GZEXE(1)

gzexe - compress executable files in place SYNOPSIS
gzexe name ... DESCRIPTION
The gzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a penalty in performance). For example if you execute ``gzexe /usr/bin/gdb'' it will create the following two files: -rwxr-xr-x 1 root root 1026675 Jun 7 13:53 /usr/bin/gdb -rwxr-xr-x 1 root root 2304524 May 30 13:02 /usr/bin/gdb~ /usr/bin/gdb~ is the original file and /usr/bin/gdb is the self-uncompressing executable file. You can remove /usr/bin/gdb~ once you are sure that /usr/bin/gdb works properly. This utility is most useful on systems with very small disks. OPTIONS
-d Decompress the given executables instead of compressing them. SEE ALSO
gzip(1), znew(1), zmore(1), zcmp(1), zforce(1) CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the PATH environment variable to find gzip and some standard utilities (basename, chmod, ln, mkdir, mktemp, rm, sleep, and tail). BUGS
gzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases, using chmod or chown. GZEXE(1)

Featured Tech Videos

All times are GMT -4. The time now is 04:07 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy