Hrmmm...I just tried something different...
I changed the initialization of C_prog_state:ep and C_prog_state:sp in libpstate.h from:
Code:
S_prog_state *psp[];
S_prog_error *pep[];
to:
Code:
S_prog_state **psp;
S_prog_error **pep;
This required that I change the definitions in libpstate.cpp from:
Code:
for ( int i = 0; i < C_prog_state::states; i++ ) {
C_prog_state::psp [ i ] =
new S_prog_state;
C_prog_state::pep [ i ] =
new S_prog_error;
...
to:
Code:
*C_prog_state::psp = new S_prog_state [ C_prog_state::states ];
*C_prog_state::pep = new S_prog_error [ C_prog_state::states ];
Now I get seg fault when I run it and when I debug it, it dies at the same place as before, but the output is somewhat different...
[root@mmphtnws312 libpstate]# gdb libpstatetest
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
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 "i386-redhat-linux-gnu"...
(gdb) add-symbol-file libpstate.o
add symbol table from file "libpstate.o" at
(y or n) y
Reading symbols from libpstate.o...done.
(gdb) break C_prog_state:rint_state
Breakpoint 1 at 0x8048e9b: file libpstate.cpp, line 139.
(gdb) run
Starting program: /test/tbsreports/dev/libpstate/libpstatetest
Breakpoint 1, C_prog_state:rint_state(int) (this=0xbffff130, state_index=0)
at libpstate.cpp:139
139 << C_prog_state:sp [ state_index ] ->argument << "\n";(gdb) n
Program State Information: (State Level: 0)
Current library:
140 return 0;
(gdb) n
141 };
(gdb) n
main () at libpstatetest.cpp:12
12 cps.print_error ( 0 );
(gdb) n
13 return 0;
(gdb) n
14 }
(gdb) n
0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
(gdb) n
Single stepping until exit from function __libc_start_main,
which has no line number information.
Current module:
Program exited with code 0250.
But since no one seems to be able to help me, I guess I will go away now.