From: Ladanyi (ladanyi_at_watson.ibm.com)
Date: Tue Jul 21 1998 - 22:46:16 BST
ups and gcc 2.8.1 does not seem to work together on linux (debian 1.3, based
on libc5). Below is what I have done and was able to reproduce the same
problem with ups 3.32 as well.
Basically, I have compiled ups with gcc 2.7.2 with -g and then under this ups
I ran itself debugging x.C compiled with g++ 2.8.1. This caused ups to
segfault. (I had ups crashing with a gcc 2.8.1 compiled C code as well, but
couldn't isolate a the problem so easily as with C++.) Exact details are
below.
Could anybody help me to get ups correctly debug codes compiled with gcc 2.8.1?
Thanks in advance,
--Laci
=========
ups was compiled with gcc 2.7.2.1
galadriel# /usr/bin/gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2.1/specs
gcc version 2.7.2.1
To get ups to compile I had to change the following things. These shouldn't
matter.
galadriel# diff -w -r ups-3.31-RGA ups-3.31-RGA-orig
diff -w -r ups-3.31-RGA/Makefile ups-3.31-RGA-orig/Makefile
63,64c63,64
< RANLIB = ranlib
< SVR4_LINKFLAGS=-L/usr/X11R6/lib
---
> RANLIB = :
> SVR4_LINKFLAGS=-R/usr/openwin/lib -L/usr/openwin/lib
diff -w -r ups-3.31-RGA/lib/libmtrprog/failmesg.c ups-3.31-RGA-orig/lib/libmtrprog/failmesg.c
20,21c20
< /* extern const char *const sys_errlist[]; -- doescn't compile :-( -- LL. */
< extern char* sys_errlist[];
---
> extern const char *const sys_errlist[];
diff -w -r ups-3.31-RGA/lib/libukcprog/formf.c ups-3.31-RGA-orig/lib/libukcprog/formf.c
42,43c42
< /* extern const char *const sys_errlist[]; -- doescn't compile :-( -- LL. */
< extern char* sys_errlist[];
---
> extern const char *const sys_errlist[];
diff -w -r ups-3.31-RGA/lib/libukcprog/logf.c ups-3.31-RGA-orig/lib/libukcprog/logf.c
54,55c54
< /* extern const char *const sys_errlist[]; -- doescn't compile :-( -- LL. */
< extern char* sys_errlist[];
---
> extern const char *const sys_errlist[];
diff -w -r ups-3.31-RGA/lib/libx11wn/wn_init.c ups-3.31-RGA-orig/lib/libx11wn/wn_init.c
507,508c507
< /* extern const char *const sys_errlist[]; --- doesn't compile :-( LL. */
< extern char* sys_errlist[];
---
> extern const char *const sys_errlist[];
diff -w -r ups-3.31-RGA/ups/obj_env.c ups-3.31-RGA-orig/ups/obj_env.c
31c31
< /* extern const char **environ; -- not needed. it's in stdlib.h -- LL. */
---
> extern const char **environ;
diff -w -r ups-3.31-RGA/ups/xc_builtins.c ups-3.31-RGA-orig/ups/xc_builtins.c
160,161c160
< /* extern const char *const sys_errlist[]; -- doescn't compile :-( -- LL. */
< extern char* sys_errlist[];
---
> extern const char *const sys_errlist[];
========== x.C : sample code that breaks ups ===============================
#include <vector>
#include <stdio.h>
int main(){
vector<int> x;
x.push_back(1);
x.push_back(2);
x.push_back(3);
vector<int>::iterator i;
for (i=x.begin(); i!=x.end(); i++)
printf("%i\n", *i);
return 0;
}
=========== compiling x.C with g++ v.2.8.1==============================
galadriel# g++ --version
2.8.1
galadriel# g++ -o x.o -c -g x.C
galadriel# g++ -o x x.o
=========================================
I put a breakpoint on the "for" line; when stops click on "i" to get its value.
ups then crashes and the stack trace is:
Functions
main ups.c:652
ups ups.c:1028
re_event_loop reg.c:818
source_window_event_handler ui_src.c:775
do_var_selection ui_src.c:436
display_var_in_mangled_form obj_stack.c:1376
match_name_end_in_func obj_stack.c:1323
ao_get_fu_blocks ao_symload.c:999
get_fi_types ao_symload.c:425
Class ao_symparse.c:742
TypeId ao_symparse.c:1033
TypeDef ao_symparse.c:1533
Record ao_symparse.c:1719
Field ao_symparse.c:1864
TypeId ao_symparse.c:1038
tnum_to_type ao_symparse.c:550
get_type ao_symparse.c:435
get_def ao_symparse.c:317
------------- SIGSEGV -------------
Variables:
stf_t <stf{0}> *0x813d13c
char <stf_name{0}> "x.C"
language_t <stf_language> LANG_CC
Compiler_type <stf_compiler_type> CT_GNU_CC
symtab_t *<stf_symtab> 0x8139b34
fil_t *<stf_fil> 0x813d204
int <stf_symno> 1
int <stf_symlim> 975
unsigned long <stf_addr> 134516024
unsigned <stf_flags> 0
char <stf_objpath_hint{0}> *NULL
char <stf_objname{0}> *NULL
long <stf_obj_mtime> 0
char <stf_global_prefix{0}> *NULL
undefined struct symio_s *<stf_symio> 0x8139d24
Addr_range <stf_range[0]> *0x813d174
snlist_t *<stf_snlist> 0x814217c
Ftype *<stf_ftypes> 0x8153064
hf_t <stf_fmap{0}{0}> *0x813d234
hf_t <stf_fmap{1}{0}> *0x53535353
hf_t <stf_fmap{2}{0}> *0x81421ce
hf_t <stf_fmap{3}{0}> *0x1
hf_t <stf_fmap{4}{0}> *0x1
hf_t <stf_fmap{5}{0}> *0x8139b34
hf_t <stf_fmap{6}{0}> *0x8142274
hf_t <stf_fmap{7}{0}> *0x3cf
hf_t <stf_fmap{8}{0}> *0x410
int <stf_mapsize> 1
int <stf_fnum> 0
------- lines 224..343 --------
------- lines 288..335 --------
int <fnum> 8
(this is enough to crash it, stf_fmap{8} is bogus.)
This archive was generated by hypermail 2.1.4 : Wed Feb 13 2002 - 21:51:32 GMT