🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #50245

getting debug information

#50245
From: Harald Dunkel
Date: Thu, 04 Nov 1993 09:42
42 lines
2041 bytes
Hello, netland.

Is there any kind of description about how to get the debug information
(the stuff included into the binaries using gcc's -g option)? Are there
some kind of library functions available?

What I like to get is the filename, function or variable names, linenumber, 
stack frame and all this stuff from the calling function, for example:

void checkit(void)
{
/*
	computing, computing ...
 */
	if (error_condition) {
		char *calling_function = get_calling_function_name();
		char *calling_file = get_file_name(calling_function);
		int lineno = get_lineno(calling_function);
		fprintf(stderr, 
			"Hey, something went wrong in function %s, %s, %d\n",
		calling_function, calling_file, lineno);
		exit(1);
	}
}

The trick is to get this information without recompilation (I don't wanna use 
assert(), __LINE__ or __FILE__) just from the debug information. The purpose
is to build debugging libraries.

Any ideas or suggestions?

Thanx in advance

Harri
--
                                                 Harald Dunkel
       /       /                        __/      CADIS GmbH
      /       /                                  Kaiserstr. 100
     ______  /    __   /      __/  __/  /        52134 Herzogenrath, Germany
    /       /    /    /      /    /    /         Phone: +49 2407 9558 0
   /       /    /    /      /    /    /          Fax:   +49 2407 9558 44
__/     __/  _________/  __/  __/  __/           EMail: dunkel@cadis.de
Technical Details
Message-ID: <2baiqn$akq@sun2.cadis.de>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!sunmbx.netmbx.de!Germany.EU.net!infoac.rmi.de!sun2.cadis.de!dunkel

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,5517b908da58a5ad,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-11-04 10:32:50 PST
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!sunmbx.netmbx.de!Germany.EU.net!infoac.rmi.de!sun2.cadis.de!dunkel
From: dunkel@cadis.de (Harald Dunkel)
Newsgroups: gnu.gcc.help
Subject: getting debug information
Date: 4 Nov 1993 09:42:47 GMT
Organization: Cadis GmbH
Lines: 43
Message-ID: <2baiqn$akq@sun2.cadis.de>
NNTP-Posting-Host: elc9.cadis.de