[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#608347: lowering severity



severity 608347 minor
quit

On Thu, 30 Dec 2010 15:55:24 -0800
Jorge Moraleda <jorge.moraleda@gmail.com> wrote:

> 1) For source code we will use one of the examples that come with the
> library. To obtain the example install package tbb-examples.

I was looking for a standalone C file to be used as a test case, as
originally requested, to just pass directly to gcc. 

The correct test for a -dbg package would be:
$ gcc -g -o test -ltbb test.c
$ ./test
$ gdb ./test

Then generate a seg fault in test.c or set a breakpoint and make sure
that gdb shows the correct output.

Something similar to this test for libglib2.0-0-dbg:

#include <glib.h>
int main (void) {
	GError * err = NULL;
	GHashTable * tbl = g_hash_table_new (g_direct_hash, g_direct_equal);
	g_print ("%s\n", err->message);
	g_print ("test program is ok\n");
	return 0;
}

Build with debug symbols ( -g ):

$ gcc -g -o test -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 test.c

Deliberate dereference of a NULL causes the expected seg fault:

$ gdb ./test

(gdb) run

Program received signal SIGSEGV, Segmentation fault.
0x000000000040072b in main () at test.c:6
6		g_print ("%s\n", err->message);
(gdb) p tbl
$1 = (GHashTable *) 0x602000
(gdb) p *tbl
$2 = {size = 8, mod = 7, mask = 7, nnodes = 0, noccupied = 0, 
  nodes = 0x601d20, hash_func = 0x400610 <g_direct_hash@plt>, 
  key_equal_func = 0x4005d0 <g_direct_equal@plt>, ref_count = 1, version = 0, 
  key_destroy_func = 0, value_destroy_func = 0}

Without the libglib2.0-0-dbg package, the *tbl symbol can't be resolved
- that's what the -dbg package is gives you.

> 3) The README.debian file now calls to execute "make" to build all
> examples. 

That's a separate bug. It doesn't affect the -dbg package which is
meant for a different purpose. IMHO it may be better for the examples
package to omit the Makefiles completely or document clearly that the
supplied Makefiles are only examples too and you need to use the
example source code in your own projects with your own make config.

> Unfortunately the Makefiles shipped with the examples have
> not been debianized, so they will fail because the directory
> structure in debian is not the same one that you get when you install
> directly from http://www.threadingbuildingblocks.org/file.php?fid=77,

Distribution setups differing from upstream is not a bug. Your build
needs to compensate.

> which is what the current Makefiles expect (this is a separate bug
> that should be filed against package tbb-examples), so instead, we
> will fix the Makefile for one of the examples:

That's the probable source of this bug. The way to actually use the -dbg
package would be in gdb, not make itself. The code causes the seg
fault, the -dbg package merely gives you information about the symbols
involved. (The /usr/lib/debug/usr/lib/libtbb.so.2 is just a version of
libtbb.so.2 which retains the debugging symbols by not being stripped
before packaging.)

Make the examples where they are in a local build but don't install
anywhere. Then run the examples under gdb and let gdb pick up the
symbols - ensure that the example code is linked against
the /usr/lib/libtbb.so.2 library for
the /usr/lib/debug/usr/lib/libtbb.so.2 symbols to be used correctly.

All you've demonstrated is that a hacky implemetation of a local build
system has problems when built with particular arguments to make. No
surprise there.

> 5) Now the debug version:
> 
> make clean
> make debug
> ./tachyon.tbb
> 
> We get a Segmentation fault

To use the -dbg package in the way that it is prepared within Debian,
you would be running the *normal* build of tachyon.tbb, linked
against /usr/lib/ (not a local dir) under gdb.

> My guess is that the libraries in debug mode need to be compiled with
> some switch in g++ but unfortunately I don't know what it is.

No, it sounds like your hacked Make configuration is simply bust and
trying to link against things in the wrong way (hence complaints about
relocate). Nothing to do with the -dbg package.

-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/

Attachment: pgpxRmaPf62k4.pgp
Description: PGP signature


Reply to: