dceの異常とhandle SIGUSR 1 nostop

6484 ワード

この異常はgdbに行ったときにあります.以下のようにします.
Program received signal SIGUSR1, User defined signal 1.
0x000000318b20f5db in raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
42                 sig);
Missing separate debuginfos, use: debuginfo-install cairo-1.8.8-3.1.el6.x86_64 gsl-1.13-1.el6.x86_64
(gdb) bt
#0  0x000000318b20f5db in raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
#1  0x00007ffff7aac435 in ns3::StackTrampoline::StackTrampoline() () at ../model/pthread-fiber-manager.cc:143
#2  0x00007ffff7aa9e09 in ns3::PthreadFiberManager::PthreadFiberManager() () at ../model/pthread-fiber-manager.cc:244
#3  0x00007ffff7ab2237 in ns3::TaskManager::SetFiberManagerType(ns3::TaskManager::FiberManagerType) () at ../model/task-manager.cc:509
#4  0x00007ffff7ab401b in ns3::Ptr ns3::DoMakeAccessorHelperOne(void (ns3::TaskManager::*)(ns3::TaskManager::FiberManagerType))::MemberMethod::DoSet(ns3::TaskManager*, ns3::EnumValue const*) const ()
    at/home/gftp/tool/network/newbake/dce/build/include/ns3.23/ns3/attribute-accessor-helper.h:383
#5  0x00007ffff7ab4a45 in ns3::AccessorHelper::Set(ns3::ObjectBase*, ns3::AttributeValue const&) const ()
    at/home/gftp/tool/network/newbake/dce/build/include/ns3.23/ns3/attribute-accessor-helper.h:187
#6  0x00007ffff739c4d7 in ns3::ObjectBase::DoSet(ns3::Ptr, ns3::Ptr, ns3::AttributeValue const&) ()
    at ../src/core/model/object-base.cc:185
#7  0x00007ffff739bc6b in ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const&) () at ../src/core/model/object-base.cc:164
#8  0x00007ffff73a021f in ns3::Object::Construct(ns3::AttributeConstructionList const&) () at ../src/core/model/object.cc:145
#9  0x00007ffff73eb879 in ns3::ObjectFactory::Create() const () at ../src/core/model/object-factory.cc:103
#10 0x00007ffff7b1db3e in ns3::Ptr ns3::ObjectFactory::Create() const ()
    at/home/gftp/tool/network/newbake/dce/build/include/ns3.23/ns3/object-factory.h:198
#11 0x00007ffff7b1c80f in ns3::DceManagerHelper::Install(ns3::NodeContainer) () at ../helper/dce-manager-helper.cc:104
#12 0x0000000000411574 in CreateNode() () at ../myscripts/ns-3-dce-quagga/example/dce-quagga-ospfd.cc:382
#13 0x0000000000412516 in main () at ../myscripts/ns-3-dce-quagga/example/dce-quagga-ospfd.cc:568
(gdb)
      Ptr taskManager = m_taskManagerFactory.Create ();
  derived->Construct (m_parameters);               DoSet (info.accessor, info.checker, *info.initialValue);
コードは(object->*m_setter)(tmp);      at/home/gftp/tool/network/newbake/dce/build/include/ns3.23/ns3/attribute-accessor-helper.h:383
raiseが現れるのは合理的であるべきで、以下のように、
  StackTrampoline ()
  {
    int status = 0;
    status = pthread_mutex_lock (&g_mutex);
    g_current = this;
    NS_ASSERT_MSG (status == 0, "lock failed");
    m_stack = malloc (SIGSTKSZ);
    stack_t newstack;
    stack_t oldstack;
    newstack.ss_sp = m_stack;
    newstack.ss_size = SIGSTKSZ;
    newstack.ss_flags = 0;
    m_vgId = VALGRIND_STACK_REGISTER (m_stack,((unsigned long)m_stack) + SIGSTKSZ);
    status = sigaltstack (&newstack, &oldstack);
    NS_ASSERT_MSG (status == 0, "first sigaltstack failed stack=" << m_stack <<
                   " stacksize=" << SIGSTKSZ);
    struct sigaction newact;
    struct sigaction oldact;
    newact.sa_handler = &StackTrampoline::SignalHandler;
    newact.sa_flags = SA_ONSTACK | SA_RESETHAND;
    sigemptyset (&newact.sa_mask);
    status = sigaction (SIGUSR1, &newact, &oldact);
    NS_ASSERT_MSG (status == 0, "first sigaction failed");
<span style="color:#FF6666;">    status = raise (SIGUSR1);</span>
    NS_ASSERT_MSG (status == 0, "raise failed");
    status = sigaltstack (&oldstack, 0);
    NS_ASSERT_MSG (status == 0, "second sigaltstack failed");
    g_current = 0;
    status = pthread_mutex_unlock (&g_mutex);
    NS_ASSERT_MSG (status == 0, "unlock failed");
  }

gdbが仕事を続けることを保証するために、私の処理は、
(gdb) handle SIGUSR1 nostop
gdbドキュメントはhttp://www.delorie.com/gnu/docs/gdb/gdb_39.html
原文部分抜粋info signals info handle
Print a table of all the kinds of signals and how GDB has been told tohandle each one. You can use this to see the signal numbers of allthe defined types of signals. info handle is an alias for info signals . handle signal keywords...
Change the way GDB handles signal signal. signalcan be the number of a signal or its name (with or without the `SIG' at the beginning); a list of signal numbers of the form `low-high'; or the word `all', meaning all theknown signals. The keywords say what change to make.
The keywords allowed by the handle command can be abbreviated.Their full names are: nostop
GDB should not stop your program when this signal happens. It maystill print a message telling you that the signal has come in. stop
GDB should stop your program when this signal happens. This impliesthe print keyword as well. print
GDB should print a message when this signal happens. noprint
GDB should not mention the occurrence of the signal at all. Thisimplies the nostop keyword as well. pass noignore
GDB should allow your program to see this signal; your programcan handle the signal, or else it may terminate if the signal is fataland not handled. pass and noignore are synonyms. nopass ignore
GDB should not allow your program to see this signal. nopass and ignore are synonyms.