public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ned Ludd <solar@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev]  Re: Split ELF Debug (default or not?)
Date: Sun, 27 Nov 2005 10:44:30 -0500	[thread overview]
Message-ID: <1133106270.5422.451.camel@localhost> (raw)
In-Reply-To: <1133104957.15135.22.camel@capella.catmur.co.uk>

On Sun, 2005-11-27 at 15:22 +0000, Edward Catmur wrote:
> On Sun, 2005-11-27 at 08:40 -0500, Ned Ludd wrote:
> > On Sun, 2005-11-27 at 15:09 +0200, Ivan Yosifov wrote:
> > > And one more thing. For proper debugging, don't I need the source to be
> > > present ?
> > 
> > -g3 -ggdb embeds the source code in the debug info so I don't see the 
> > point.
> 
> It doesn't; at least not with gcc 3.4.4. It does embed function
> prototypes and macro definitions, though.
> 
> Ed Catmur

Eh? 


solar@simple ~ $ gcc -g3 -nopie -ggdb segfault_me.c -o segfault_me
solar@simple ~ $ paxctl -permsx segfault_me
solar@simple ~ $ gdb -q ./segfault_me
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) b main
Breakpoint 1 at 0x804853d: file segfault_me.c, line 25.
(gdb) step
The program is not being run.
(gdb) r
Starting program: /home/solar/segfault_me 

Breakpoint 1, main () at segfault_me.c:25
25		foo();
(gdb) step
foo () at segfault_me.c:17
17		int i = 0; 
(gdb) 
18		for (i = 0 ; i < 3; i++) {
(gdb) 
19			printf("Just an example %d\n", i);
(gdb) 
Just an example 0
18		for (i = 0 ; i < 3; i++) {
(gdb) 
19			printf("Just an example %d\n", i);
(gdb) 
Just an example 1
18		for (i = 0 ; i < 3; i++) {
(gdb) 
19			printf("Just an example %d\n", i);
(gdb) 
Just an example 2
18		for (i = 0 ; i < 3; i++) {
(gdb) 
21		bar();
(gdb) 
bar () at segfault_me.c:13
13		baz();
(gdb) 
baz () at segfault_me.c:9
9		atexit(break_self);
(gdb) 
10	}
(gdb) 
bar () at segfault_me.c:14
14	}
(gdb) 
foo () at segfault_me.c:22
22	}
(gdb) 
main () at segfault_me.c:26
26		return 0;
(gdb) 
27	}
(gdb) 
0x400407b6 in __libc_start_main () from /lib/libc.so.6
(gdb) 
Single stepping until exit from function __libc_start_main, 
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x40050681 in kill () from /lib/libc.so.6
(gdb) 

solar@simple ~ $ cat segfault_me.c 
#include <stdio.h>
#include <signal.h>

void break_self() {
	kill(getpid(), SIGSEGV);
}

int baz() {
	atexit(break_self);
}

void bar() {
	baz();
}

void foo() {
	int i; 
	for (i = 0 ; i < 3; i++) {
		printf("Just an example %d\n", i);
	}
	bar();
}

int main() {
	foo();
	return 0;
}



# While single stepping sure looks like source code to me. 

solar@simple ~ $ gcc -v 2>&1 | tail -n 1
gcc version 3.4.4 (Gentoo Hardened 3.4.4, HTB-3.4.4_pre-1.00,
ssp-3.4.4-1.0, pie-8.7.8)

-- 
Ned Ludd <solar@gentoo.org>
Gentoo Linux

-- 
gentoo-dev@gentoo.org mailing list



  reply	other threads:[~2005-11-27 15:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-26 17:50 [gentoo-dev] Split ELF Debug (defult or not?) Ned Ludd
2005-11-26 18:30 ` Bruno
2005-11-26 18:55   ` [gentoo-dev] Split ELF Debug (default " Ned Ludd
2005-11-27  9:53     ` Kevin F. Quinn
2005-11-27 12:18       ` Ned Ludd
2005-11-26 19:15 ` [gentoo-dev] Split ELF Debug (defult " Olivier Crête
2005-11-26 19:20 ` [gentoo-dev] " R Hill
2005-11-27 12:24   ` [gentoo-dev] Re: Split ELF Debug (default " Ned Ludd
2005-11-27 13:09     ` Ivan Yosifov
2005-11-27 13:32       ` Edward Catmur
2005-11-27 13:40       ` Ned Ludd
2005-11-27 15:22         ` Edward Catmur
2005-11-27 15:44           ` Ned Ludd [this message]
2005-11-27 16:55             ` Ned Ludd
2005-11-27 21:01               ` Ivan Yosifov
2005-11-27 22:24                 ` Ned Ludd
2005-11-28 11:00                 ` Paul de Vrieze
2005-11-27 18:03         ` Mark Loeser
2005-11-27 19:51           ` Olivier Crête
2005-11-26 19:22 ` [gentoo-dev] Split ELF Debug (defult " Ivan Yosifov
2005-11-26 20:01 ` Mike Frysinger
2005-11-26 21:42 ` Petteri Räty
2005-11-27  0:48   ` Dan Meltzer
2005-11-27  0:53     ` Mart Raudsepp
2005-11-27 12:23   ` [gentoo-dev] Split ELF Debug (default " Ned Ludd
2005-11-26 23:10 ` [gentoo-dev] Split ELF Debug (defult " Luca Barbato
2005-11-27 12:54   ` Diego 'Flameeyes' Pettenò
2005-11-27 14:39     ` Dan Meltzer
2005-11-27 14:49       ` Diego 'Flameeyes' Pettenò
2005-11-27 14:50       ` Ned Ludd
2005-11-27 15:31       ` Edward Catmur
2005-11-28  1:18     ` Georgi Georgiev
2005-11-28  4:21       ` Edward Catmur
2005-11-27 15:04 ` Tavis Ormandy
2005-11-27 15:30   ` Dan Meltzer
2005-11-28 11:14     ` Paul de Vrieze
2005-11-27 22:35 ` Spider (D.m.D. Lj.)
2005-11-28 10:51 ` Paul de Vrieze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1133106270.5422.451.camel@localhost \
    --to=solar@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox