Sponsored Content
Full Discussion: Abrupt GDB Behaviour
Top Forums UNIX for Dummies Questions & Answers Abrupt GDB Behaviour Post 302792391 by Praveen_218 on Wednesday 10th of April 2013 10:25:36 AM
Old 04-10-2013
Just compiled the code like this:

Code:
$ gcc -g3 -Wall -Werror main.c -o M2
$ ll
total 20
-rwxr-xr-x  1 praveen_218  grp  14144 Apr 10 19:45 M2
-rw-r--r--  1 praveen_218  grp    270 Apr 10 19:34 main.c

The output should be like the below:
Code:
$ gdb ./M2
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) r
Starting program: /.amd/bng-enghomes001-cf1-6/vol/home6/homes6/pkumarpr/tr/gdbTrials/M2
0123456789

Program exited normally.
(gdb) b fn
Breakpoint 1 at 0x8048406: file main.c, line 10.
(gdb) r
Starting program: /.amd/bng-enghomes001-cf1-6/vol/home6/homes6/pkumarpr/tr/gdbTrials/M2

Breakpoint 1, fn () at main.c:10
10         printf("0");
(gdb) n
11         printf("1");
(gdb) n
12         printf("2");
(gdb) n
13         printf("3");
(gdb) n 2
15         printf("5");
(gdb) n 4
19         printf("9");
(gdb) n 3
0123456789
28          return(0);
(gdb)

This is the behavior expected, however it is on FreeBSD7.1 and the gdb on Linux behaves exactly the same unless on the latest version of GDB linux port introducing any kind of gdb-local environmental variable masking the next default. This might be the latest feature. Without this I don't find any reason (no doubt on the GDB code unless you compiled a tweaked source of it to install the same).

Look the release note of the GDB version you are using and try to grep for next to get better insight on the environmental variable, if any.
This User Gave Thanks to Praveen_218 For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

GDB or DBX??

Which is better?? I have always been a gdb fan.. But ppl say dbx is beter better for debugging the core.. Do all GDB lovers agree to it??? :cool: (1 Reply)
Discussion started by: jyotipg
1 Replies

2. Programming

gdb Tutorials

Can anyone give me the link to a website having gdb tutorials (for advanaced debugging & shortcuts) http://www.burneddowndays.com/talk/YaBBImages/rolleyes.gif (1 Reply)
Discussion started by: wojtyla
1 Replies

3. Solaris

gdb for SunOS 5.6

I want to install gdb on SunOS 5.6 machine. Where can i download from ? (1 Reply)
Discussion started by: shafi2all
1 Replies

4. UNIX for Advanced & Expert Users

Gdb:

Hi, This is a simple question on GDB. Given a core file, how can you check which process has dumped the core? Regards - Krishna (1 Reply)
Discussion started by: krishnamurthig
1 Replies

5. UNIX for Advanced & Expert Users

Gdb

Hi All, I wanted to know if there is a core file generated and I am not sure for which Binary it is generated . Can I use gdb to debug the core file ? Thanks. (1 Reply)
Discussion started by: shubhranshu
1 Replies

6. UNIX for Advanced & Expert Users

Using Gdb

Hi All, I am trying to execute a binary and it is giving Segmentation Fault. Can I use gdb to debug this error? Secondly there is no core file generated , so when I an trying to run gdb with the binary only I am not able to set any breakpoints. When I am running the gdb and the I am... (1 Reply)
Discussion started by: shubhranshu
1 Replies

7. Programming

gdb not found

Hello, I am having problem with debugging my code. I am writing a C code and then I compile it with the Makefile. I make a target file and then copy it in my Robot(Khepera III) and then run the program over there. I compile it ofcorse on my machine and then copy the compiled file in the... (10 Replies)
Discussion started by: mind@work
10 Replies

8. Programming

gdb help

i have created some break points in gdb. let's say.... b sqlcxt how can i know the breakpoint name of sqlcxt ??? (1 Reply)
Discussion started by: lipun4u
1 Replies

9. Programming

Qemu + gdb

Hi, I got: host machine: RedHat (RHEL6) virtual machine: RedHat (RHEL6) I run (on host machine): qemu-system-x86_64 ...... -S -s after that i run (on host machine): gdb target remote localhost:1234 set architecture i386:x86-64 and then i can use (on host machine) 'ctrl + c' to... (2 Replies)
Discussion started by: Chrisdot
2 Replies

10. Programming

Gdb backtrace

Hi, all I try to understand the output from gdb Program received signal SIGABRT, Aborted. *** glibc detected *** /home/sys_cbo/dev/zif/bin/Debug/zifd: free(): invalid pointer: 0x00007fffac04d3d0 *** how should i read this? (gdb) backtrace #0 0x0000003015e32925 in raise () from... (1 Reply)
Discussion started by: huvcbo
1 Replies
GZEXE(1)						      General Commands Manual							  GZEXE(1)

NAME
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)
All times are GMT -4. The time now is 05:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy