[freetds] FreeTDS 0.64, AIX 5.2, xlc - make check seg fault in ctlib

Luke Bakken luke.bakken at gmail.com
Fri Jul 28 13:42:36 EDT 2006

Hello all,

With much manipulation of Makefiles I got FreeTDS to compile and
install sucessfully on my AIX 5.2 machine. TSQL can connect to my SQL
2005 db and I can sucessfully make queries with it.

However ...

make check succeeds 15 times in src/tds/unittests but fails in
src/ctlib/unittests with segfaults in every test. So I thought I'd
fire up the debugger and see what is going on. Trouble is, I don't
seem to know how to get gdb (or dbx) to read the debug information
from the libct.a file. I'm hoping someone here can help nudge me in
the correct direction - I would love to help out in getting FreeTDS
better supported on AIX.

Below is my gdb session ...

$ gdb --directory . --directory ../../tds --directory .. t0001
GNU gdb 6.0
Copyright 2003 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 "powerpc-ibm-aix5.1.0.0"...

(gdb) dir
Reinitialize source path to empty? (y or n) n

Source directories searched:
(gdb) break main
Breakpoint 1 at 0x10000378: file t0001.c, line 19.
(gdb) run
Starting program: /opt/tmp/freetds-0.64/src/ctlib/unittests/t0001

Breakpoint 1, main (argc=1, argv=0x2ff22ba8) at t0001.c:19
19              int verbose = 0;
(gdb) s
21              fprintf(stdout, "%s: Testing login, logout\n", __FILE__);
(gdb) n
t0001.c: Testing login, logout
22              if (verbose) {
(gdb) n
25              ret = try_ctlogin(&ctx, &conn, &cmd, verbose);
(gdb) s
try_ctlogin (ctx=0x2ff22b40, conn=0x2ff22b44, cmd=0x2ff22b48,
verbose=0) at common.c:83
83              ret = read_login_info();
(gdb) n
84              if (ret != CS_SUCCEED) {
(gdb) n
90              ret = cs_ctx_alloc(CS_VERSION_100, ctx);
(gdb) s
cs_ctx_alloc (version=112, ctx=0x2ff22b40) at cs.c:199
199             *ctx = (CS_CONTEXT *) malloc(sizeof(CS_CONTEXT));
(gdb) n
200             memset(*ctx, '\0', sizeof(CS_CONTEXT));
(gdb) n
201             tds_ctx = tds_alloc_context(*ctx);
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0xd4087470 in tds_alloc_context () from

More information about the FreeTDS mailing list