-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On January 4, 2002 05:09 pm, Mark Swanson wrote:
> Since this requires Tux to test, how would you like me to help resolve
> this?
OK. I have isolated the problem and wrote code to show this happening without
Tux involvement. The code below works on 3.0.2 but not 3.0.3 OR 3.1 beta even
with the latest binutils.
Running ./bugLoad will show (aborted), but on 3.0.2 it works.
Hopefully this small example is all you need.
Let me know if I can do anything to help.
# Make targets
bugLoad: bugLoad.c BugLib.tux.so
${GCC} -rdynamic -ldl bugLoad.c -o bugLoad
BugLib.o: BugLib.cpp
${CC} ${RELEASE_CPPFLAGS} -c BugLib.cpp
BugLib.tux.so: BugLib.o
${CC} ${LINK} -O2 -Wall -D_REENTRANT -shared -o $@ BugLib.o -lstdc++
- -lgcc_s
chmod a-x $@
*** bugLoad.c dynamic load harness ****
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/wait.h>
#include <linux/unistd.h>
#include <unistd.h>
#include <string.h>
#include <pwd.h>
#include <grp.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <regex.h>
#include <fcntl.h>
#include <time.h>
#include <sys/mman.h>
#include <dlfcn.h>
#include <popt.h>
#include <sys/socket.h>
#include <ctype.h>
//#include <glib.h>
int main(int argc, char** argv) {
void* handle;
void (*mod_init) (void);
char libname[] = "./BugLib.tux.so";
handle = dlopen (libname, RTLD_LAZY);
printf ("handle: %p\n", handle);
if (!handle) {
printf("%s: dlopen() handle missing", dlerror());
}
mod_init = dlsym(handle, "TUXAPI_init");
if (!mod_init) {
printf("%s: TUXAPI_init() function missing", strerror(errno));
}
printf ("TUXAPI_init: %p\n", mod_init);
if(mod_init)
mod_init();
}
******* BugLib.cpp (shows the bug) *******
//
// $Id: TuxModule.cpp,v 1.5 2002/01/04 21:19:15 mswanson Exp $
//
extern "C" {
#include "tuxmodule.h"
void TUXAPI_init();
int TUXAPI_handle_events (user_req_t *req);
}
#include "syslog.h"
#include "TestException.h"
int TUXAPI_handle_events (user_req_t *req) {
return TUX_RETURN_USERSPACE_REQUEST;
}
//TUXAPI_handle_events
// 1. open syslog
// 2.
void TUXAPI_init() {
openlog("BugLib", LOG_PID | LOG_CONS | LOG_NDELAY, LOG_DAEMON);
syslog(LOG_INFO, "TUXAPI_init()");
try {
throw TestException("test123");
return;
} catch(TestException e) {
// This never happens
syslog(LOG_INFO, "Success");
}
}
******* TestException.h ***********
#ifndef _EXCEPTION_H
#define _EXCEPTION_H
#include <string.h>
class TestException {
protected:
char msg[1024];
public:
TestException(const char *errorMessage) {
strcpy(msg, errorMessage);
}
};
#endif
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD4DBQE8NjSTP6+Az0OIt2IRAmjXAJihLQ88VaUD5uL7c2JvOLoO1c1ZAKCWMwcm
nGkqjzS8cDEELlZ5gfCXvw==
=1tCF
-----END PGP SIGNATURE-----