coredump due to SIGBUS

Hi All,

I'm getting the following coredump due to SIGBUS.
But the stack trace shows the problem is in down_cast.
Following are the pflags and stack traces for your references.

OS & Processor used: Solaris10 & SUN ULTRA SPARC

pflags:

/5: flags = 0
sigmask = 0xffffbefc,0x0000ffff cursig = SIGBUS

Stack trace:

----------------- lwp# 5 / thread# 5 --------------------
ffffffff6fd08bf4 __1cG__CrunJdown_cast6Fpvpkn0AQstatic_type_info_4_ 1_ (24d8c4f80, ffffffff73d33028, ffffffff73cf71f8, ffffff
ff78f170d0, 5a1ca4, a70) + 14

ffffffff73675830 __1cFpdfcoNCCoCoreThreadDrun6M_v_ (100218ec0, 1938, 258ea1738, ffffff92, ffffffff701c7f30, ffffffff71c8c0d0
) + 278
ffffffff738a6c08 __1cFpdfcoMCCoThreadObjKthreadFunc6Fpv_2_ (100218ec0, 1fc000, 0, ffffffff73e71290, ffffffff738a6bf8, ffffff
ff736755b + 10
ffffffff6fad2e7c _lwp_start (0, 0, 0, 0, 0, 0)

Any suggestions to fix the issue are welcome
Thanks in advance
Shiva
Last edited on
You are going to have to post code around the problem; numbers by themselves are meaningless.
There's a good chance that the code causing the problem isn't anywhere near the code that crashes. SIGBUS on Solaris/SPARC indicates and unaligned memory access. This typically happens because a pointer is corrupted or the stack is corrupted, though there are many other things that can cause this as well.

My recommendation is to compile with "g++ -Wall" (using GCC 4.3) and fix all of the warnings emitted -- problems that Sun Studio cannot detect. There is a reasonable chance that GCC will at least warn you of the problem (certainly much more likely than Sun Studio warning you).
as he is saying he is trying down casting.. might be he is using an invalid pointer..
try checking if you are getting a valid pointer.
No -- he says that what the stack trace shows. And indeed it does. He never made any statement about what he thinks is going on in the source code.

Last edited on
ok...

prasadi

when is the code coming ??
Thanks for ur valuable suggestions...

Even I thought the same(down casting invalid or corrupted pointer), so I put a null check for the pointer...

See the below snippet

if( m_msg != 0)
Session* sPtr = dynamic_cast<Session*>(m_msg);

Here m_msg is base class pointer and sPtr is derived class pointer and the application is running on solaris multithreaded environment

Changing from CC compiler to GCC is not possible now as project strategy doesn't allow

Shiva
I wasn't suggesting changing compilers. Well, I *do* recommend changing compilers -- Sun Studio is a poor C++ compiler -- but that wasn't the gist of my earlier suggestion. :-)

I was just suggesting compiling the code with g++ and cleaning up any warnings. All of our released Solaris code is built using Sun Studio, but we typically compile everything at least once with "g++ -Wall" to make sure the code is clean. This has made our code quite a bit more robust.

Back to your code. Is there any chance that m_msg is != 0, but does not point to a Session object?

If your check doesn't stop the problem, you could try catching std::bad_cast and exploring what m_msg contains.
I'll try compilation with "g++ -Wall" .

In code, chances of m_msg being corrupted are more(I guess).
Tried std::bad_cast also , didn't catch any exceptions.
Could be crashing somewhere else and pointing to "ffffffff6fd08bf4 __1cG__CrunJdown_cast6Fpvpkn0AQstatic_type_info_4_ 1_ (24d8c4f80, ffffffff73d33028, " this line.

Are there anyways to analyze core file so that we can find out the exact crash point or corrupted pointers???
Right -- well my suggestion to try catching std::bad_cast was silly. You are getting a SIGBUS. It's not going to help. It will be tough to give any more suggestions without knowing the code in detail. If you can cause the crash with a debug build then you may be able to navigate through the core & source with Sun Studio's debugging tools.

Good luck with this one!
Topic archived. No new replies allowed.