0

I have a coredump,it shows a reference address is NULL....

details:

(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x005b6c10 in raise () from /lib/libc.so.6
#2  0x005b8521 in abort () from /lib/libc.so.6
#3  0xf749e641 in Application::fatalSignal () at Application.cc:277
#4  <signal handler called>
#5  SdlProcess::procedureReturn (this=0x0, aSignal=0, aArg1=1, aArg2=0x0)
    at /include/c++/4.1.1/bits/stl_list.h:652
#6  0x08112edb in Sdl::authFailurer (aSdlProcess=@0x0, aLabel=0, aSignal=0, arg2=0x0) at /Mgr/SdlAuth.cc:1781
#7  0x00000000 in ?? ()
================
define:
Sdl::authFailurer(SdlProcess& aSdlProcess, int aLabel, int aSignal, int /*arg1*/, void* arg2)

#5 aSdlProcess.procedureReturn(0, 1, 0);

and in stl_list.h:652

 bool empty() const

      { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }    ---->652
in procedureReturn()
{
   ...
  if (!mProcedureStack.empty())---->here,mProcedureStack is a datamember of SdlProcess
   ...
  {
  ...}
}
1
  • 2
    A reference can only become NULL through undefined behaviour, such as dereferencing a NULL pointer. Commented Sep 26, 2012 at 3:14

2 Answers 2

1

You can get a NULL reference by dereferencing a NULL pointer. I'm not sure how that could happen in this particular case, unless mProcedureStack is a reference.

Sign up to request clarification or add additional context in comments.

1 Comment

list<SdlProcedureStatus*> mProcedureStack;
1

The most often cause of this problem is when you return a dangling reference, such as:

int& foo() {
   int bar = 5;
   return bar;
}

The returned reference for foo now points to the stack and will contain undefined data.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.