Goto Patch and Bizzare Bug (HELP)


Subject: Goto Patch and Bizzare Bug (HELP)
From: sam th (sam@bur-jud-118-039.rh.uchicago.edu)
Date: Thu Jun 01 2000 - 05:12:45 CDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've run into an extremely bizarre bug. Maybe someone out there can help
me track it down.

The attached patch is an updated version of Joaquin's Goto patch. It
should apply properly against current trees. If you compile it normally,
it will run just fine, and demonstrate Joaquin's quality dialog. However,
if you compile it into a debug build, then on startup, you get a segfault,
because a pure virtual function gets called (always bad). The stack trace
looks like this:

gdb) bt
#0 0x402e64e1 in __kill () from /lib/libc.so.6
#1 0x402e6156 in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2 0x402e7868 in abort () at ../sysdeps/generic/abort.c:88
#3 0x81c7bf8 in __terminate ()
#4 0x81c7c15 in __terminate ()
#5 0x81c879b in __pure_virtual ()
#6 0x80d7e20 in AP_Prefs::overlaySystemPrefs (this=0x8328bb0) at
ap_Prefs.cpp:131
#7 0x80d7d61 in AP_Prefs::loadBuiltinPrefs (this=0x8328bb0) at
ap_Prefs.cpp:118
#8 0x80d7be0 in AP_Prefs::fullInit (this=0x8328bb0) at ap_Prefs.cpp:62
#9 0x80a4aa7 in AP_UnixApp::initialize (this=0x8328550) at
ap_UnixApp.cpp:127
#10 0x80a6b97 in AP_UnixApp::main (szAppName=0x81d0408 "AbiWord Personal",
argc=1, argv=0xbffffb14)
    at ap_UnixApp.cpp:833
#11 0x809538b in main (argc=1, argv=0xbffffb14) at UnixMain.cpp:24
#12 0x402e01eb in __libc_start_main (main=0x8095370 <main>, argc=1,
argv=0xbffffb14,
    init=0x8093704 <_init>, fini=0x81d03e0 <_fini>, rtld_fini=0x4000a610
<_dl_fini>,
    stack_end=0xbffffb0c) at ../sysdeps/generic/libc-start.c:90

What has happend is that in frame #6 (the last one in our code) we have
this line.

131 const char * szSystemDefaultPrefsDir = m_pApp->getAbiSuiteAppDir();

Now m_pApp should be of type AP_UnixApp. But gdb tells me the following:

(gdb) ptype m_pApp
type = class XAP_App {

And, of course, getAbiSuiteAppDir() is pure virtual for XAP_App. So
somewhere, the real type got sliced off.

It turns out the this slicing happens when AP_UnixApp::initialize calls
m_prefs->fullInit(). If you step through the program, before line 127, if
you execute
        m_prefs.m_pApp->getAbiSuiteAppDir()

you get the right answer ("/usr/local/AbiSuite/AbiWord").

Once you step into line 127, the following call should be equivalent:
        *this).m_pApp->getAbiSuiteAppDir()

But instead of the same answer, you get a SIGABRT. bad.

I have no idea why this simple change would make such a difference.

Now, I would like to be able to step through the non-debug build to see
what is happening. But that's the trouble with problems that only show up
in debug - you can't compare them.

To further confuse you, the debug nature of the build should have no
effect. I grepped through the differences between the tree with problems,
and the current CVS tree, and the only time debug appeared was in
UT_DEBUGMSG. Therefore, the debug and normal builds should behave
identically. But, of course, they don't.

Well, if you're still reading, I'm impressed.

Nobody ever said I wasn't thorough.

If you have *any* idea what is going on here, please help.
           
                                     sam th
                                     sam@uchicago.edu
                                http://sam.rh.uchicago.edu

PS - I love GDB.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5Njcft+kM0Mq9M/wRAgwyAKDRg/R7qpHehJtI7QQhd3UMtIrbCgCfV0TS
M23kFFD8HiZTUYQhjSCLZRE=
=Hj6V
-----END PGP SIGNATURE-----




This archive was generated by hypermail 2b25 : Thu Jun 01 2000 - 05:12:35 CDT