Re: gdb in realloc(): error: junk pointer, too high to make sense on FreeBSD 5.2+ [SOLVED]

2006-07-10 Thread Philip M. Gollucci
Paul Querna wrote:
 Philip M. Gollucci wrote:
 Hi,

 2 years ago, PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/68727
 was filed about gdb itself segfaulting when trying to debug httpd.
 This PR hasn't seen any action AFAIK.
Its been 2 years in the making

GDB 6.5 works flawlessly with no local mods.

I used the attached script to test with
against perl 5.8.8 httpd 2.2.2(prefork) mod_perl trunk

I'm going to work on creating
ports/devel/gdb65
src/contrib/gdb (vendor import)

[EMAIL PROTECTED] 
/home/pgollucci/dev/compile/freebsd-6.1-stable/3.4.4/mod_perl/r420729-5.8.8-2.0.58-prefork
 22
   5 0./t/TEST -debug=gdb
GNU gdb 6.5
Copyright (C) 2006 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-unknown-freebsd6.1...
[Mon Jul 10 22:19:41 2006] [info] 6 Apache2:: modules loaded
[Mon Jul 10 22:19:41 2006] [info] 0 APR:: modules loaded
[Mon Jul 10 22:19:41 2006] [info] base server + 30 vhosts ready to run tests
[Mon Jul 10 22:19:43 2006] [warn] The Alias directive in mod_perl at line 1 
will probably never match because it overla
   ps an earlier Alias.
[Mon Jul 10 22:19:43 2006] [warn] The Alias directive in mod_perl at line 1 
will probably never match because it overla
   ps an earlier Alias.


THIS IS HUGE




-- 

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.
#!/bin/sh -x

chdir /home/pgollucci/dev/dist
fetch -mva http://ftp.gnu.org/gnu/gdb/gdb-6.5.tar.gz

chdir /home/pgollucci/dev/src
tar -xvzf ../dist/gdb-6.5.tar.gz
mkdir -p /home/pgollucci/dev/src/gdb-6.5 
/home/pgollucci/dev/compile/freebsd-6.1-stable/3.4.4
cp -R /home/pgollucci/dev/src/gdb-6.5 
/home/pgollucci/dev/compile/freebsd-6.1-stable/3.4.4

chdir /home/pgollucci/dev/compile/freebsd-6.1-stable/3.4.4/gdb-6.5
./configure \
--prefix=/usr/local/software/freebsd-6.1-stable/3.4.4/gdb/6.5 \
--enable-maintainer-mode

make

make install

# tcsh:
# setenv PATH /usr/local/software/freebsd-6.1-stable/3.4.4/gdb/6.5/bin:$PATH
# rehash


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: gdb in realloc(): error: junk pointer, too high to make sense on FreeBSD 5.2+

2006-07-03 Thread Paul Querna
Philip M. Gollucci wrote:
 Hi,
 
 2 years ago, PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/68727
 was filed about gdb itself segfaulting when trying to debug httpd.
 This PR hasn't seen any action AFAIK.

This appears to be a duplicate of this one:
http://www.freebsd.org/cgi/query-pr.cgi?pr=gnu/73512

Again, no action, I can repo this 100% on my machines as well.

 (gdb) x flags
 0x102:  Error accessing memory address 0x102: Bad address.

Can you try to get this into a simple test case? Calling apr_dso_load twice?

-Paul
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: gdb in realloc(): error: junk pointer, too high to make sense on FreeBSD 5.2+

2006-07-03 Thread Philip M. Gollucci

Paul Querna wrote:

Can you try to get this into a simple test case? Calling apr_dso_load twice?

I didn't seem to be able to cause it in a simple case; any great ideas ?

gcc -g -O0 \
-I/usr/local/software/freebsd-6.1-stable/3.4.4/apr/trunk/include/apr-1 \
-L/usr/local/software/freebsd-6.1-stable/3.4.4/apr/trunk/lib -l apr-1 \
gdb.c -o test
./test

[EMAIL PROTECTED] /home/pgollucci 145 0gdb ./test
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: /usr/home/pgollucci/test
warning: Unable to get location for thread creation breakpoint: generic error
[New LWP 100062]
[New Thread 0x8053000 (LWP 100062)]

Program exited normally.
(gdb)


Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.
/* $Id$ */

#include apr.h
#include apr_dso.h

#include stdio.h

int main(int argc, const char * const argv[]) {

  apr_pool_t *cntx;
  apr_status_t stat;
  apr_dso_handle_t *modhandle;
  const char *path = /lib/libc.so.6;

  apr_app_initialize(argc, argv, NULL);

  stat = apr_pool_create(cntx, NULL);
  if (stat != APR_SUCCESS) {
fprintf(stderr, apr_pool_create() failed to create initial context);
apr_terminate();
exit(1);
  }

  if (apr_dso_load(modhandle, path, cntx) != APR_SUCCESS) {
char my_error[256];
fprintf(stderr, apr_dso_error(modhandle, my_error, sizeof(my_error)));
  }

  if (apr_dso_load(modhandle, path, cntx) != APR_SUCCESS) {
char my_error[256];
fprintf(stderr, apr_dso_error(modhandle, my_error, sizeof(my_error)));
  }

  apr_terminate();
  exit(0);
}

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

gdb in realloc(): error: junk pointer, too high to make sense on FreeBSD 5.2+

2006-07-02 Thread Philip M. Gollucci

Hi,

2 years ago, PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/68727
was filed about gdb itself segfaulting when trying to debug httpd.
This PR hasn't seen any action AFAIK.

This has been slowly driving me mad as you can not debug any httpd startup code.
Which coincidentally also prevents you from debugging mod_perl startup code and 
most likely
mod_* (php,ruby,tcl,java,python)

I did some painstakingly slow stepping through httpd code today:

Basically after apr_dso_load() calls dlopen()  (OS level Freebsd version) the
SECOND time through (httpd parses the config twice)
The first LoadModule line (doesn't matter which) crashes gdb.

I can reliably reproduce this on _ALL_ versions of FreeBSD from 5.2 through 
6.1-STABLE and on -CURRENT.
and ALL versions of httpd 2.0.48+ or 2.2.x

Attached is the information I was able to collect, but at this point, I'm in 
WAY over my head.

[Apologies for the cross post, feel free to spam me in return]

gdb -v
GNU gdb 6.1.1 [FreeBSD]

gcc -v
gcc version 3.4.4 [FreeBSD] 20050518

I've also seen it on EVERY version of gdb in the ports tree combined with any 
version of gcc in the ports tree.
/usr/local/bin/gcc32
/usr/local/bin/gcc33
/usr/local/bin/gcc34
/usr/local/bin/gcc40
/usr/local/bin/gcc41
/usr/local/bin/gcc42


Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

In all that I've done wrong I know I must have done something right to
deserve a hug every morning and butterfly kisses at night.
(gdb) bt
#0  apr_dso_load (res_handle=0xbfbfe15c, path=0x80f8760 
/usr/local/software/frebsd-6.1-stable/3.4.4/httpd/2.2.2/prefork/modules/mod_authn_file.so,
 pool=0x80bd018)
at /usr/home/pgollucci/dev/src/httpd-2.2.2/srclib/apr/dso/unix/dso.c:126
#1  0x08089b73 in load_module (cmd=0xbfbfe4d0, dummy=0xbfbfe348, 
modname=0x80f8728 authn_file_module, filename=0x80f8740 
modules/mod_authn_file.so) at mod_so.c:238
#2  0x0807824d in invoke_cmd (cmd=0x809da80, parms=0xbfbfe4d0, 
mconfig=0xbfbfe348, args=0x80f104e ) at config.c:778
#3  0x0807969b in execute_now (cmd_line=0x80f86b8 LoadModule, args=0x80f1023 
authn_file_module modules/mod_authn_file.so, parms=0xbfbfe4d0, p=0x80bd018, 
ptemp=0x80ef018, 
sub_tree=0xbfbfe348, parent=0x0) at config.c:1419
#4  0x08078c6c in ap_build_config_sub (p=0x80bd018, temp_pool=0x80ef018, 
l=0x80f1018 LoadModule authn_file_module modules/mod_authn_file.so, 
parms=0xbfbfe4d0, current=0xbfbfe3a4, 
curr_parent=0xbfbfe3a0, conftree=0x80a4674) at config.c:990
#5  0x080791ad in ap_build_config (parms=0xbfbfe4d0, p=0x80bd018, 
temp_pool=0x80ef018, conftree=0x80a4674) at config.c:1202
#6  0x08079b2a in process_resource_config_nofnmatch (s=0x80beeb8, 
fname=0x80f7408 
/usr/local/software/frebsd-6.1-stable/3.4.4/httpd/2.2.2/prefork/conf/httpd.conf,
 
conftree=0x80a4674, p=0x80bd018, ptemp=0x80ef018, depth=0) at config.c:1612
#7  0x08079c25 in ap_process_resource_config (s=0x80beeb8, fname=0x80f7408 
/usr/local/software/frebsd-6.1-stable/3.4.4/httpd/2.2.2/prefork/conf/httpd.conf,
 conftree=0x80a4674, 
p=0x80bd018, ptemp=0x80ef018) at config.c:1644
#8  0x0807a730 in ap_read_config (process=0x80bb098, ptemp=0x80ef018, 
filename=0x8095a01 conf/httpd.conf, conftree=0x80a4674) at config.c:2002
#9  0x08062083 in main (argc=2, argv=0xbfbfe778) at main.c:681


apr_dso_load (res_handle=0xbfbfe15c, path=0x80f8760 
/usr/local/software/frebsd-6.1-stable/3.4.4/httpd/2.2.2/prefork/modules/mod_authn_file.so,
 pool=0x80bd018)
at /usr/home/pgollucci/dev/src/httpd-2.2.2/srclib/apr/dso/unix/dso.c:126
126 int flags = RTLD_NOW | RTLD_GLOBAL;
(gdb) s
139 os_handle = dlopen(path, flags);
(gdb) s
0x28173e24 in pthread_rwlock_timedwrlock () from /usr/lib/libpthread.so.2
(gdb) s
Single stepping until exit from function pthread_rwlock_timedwrlock, 
which has no line number information.
0x28179a44 in pthread_mutexattr_init () from /usr/lib/libpthread.so.2
(gdb) s
Single stepping until exit from function pthread_mutexattr_init, 
which has no line number information.
0x28173cc5 in pthread_rwlock_timedwrlock () from /usr/lib/libpthread.so.2
(gdb) s
Single stepping until exit from function pthread_rwlock_timedwrlock, 
which has no line number information.
0x281833c0 in __error () from /usr/lib/libpthread.so.2
(gdb) s
Single stepping until exit from function __error, 
which has no line number information.
0x28173d34 in pthread_rwlock_timedwrlock () from /usr/lib/libpthread.so.2
(gdb) s
Single stepping until exit from function pthread_rwlock_timedwrlock, 
which has no line number information.
s
gdb in realloc(): error: junk pointer, too high to make sense
Abort (core dumped)


#0  apr_dso_load (res_handle=0xbfbfe15c, path=0x80f8760