Debug error – SIGSEGV in watch

Sysprogs forums Forums VisualGDB Debug error – SIGSEGV in watch

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8003
    Char
    Participant

    I got bug with  VisualGDB-5.1.4.676 .

    If i add bad  condition to watch in VS debug stops when it tr to evaluate it. in this case order->CancelReplaceOrder() is nullptr .

    [ 16572 ms] -var-create –frame 0 –thread 1 – * “order->CancelReplaceOrder()->OrderStatus()”
    [ 16651 ms] ~”\nProgram received signal ”
    [ 16651 ms] ~”SIGSEGV, Segmentation fault.\n”
    [ 16651 ms] ^done,reason=”signal-received”,signal-name=”SIGSEGV”,signal-meaning=”Segmentation fault”,frame={addr=”0x000000000062c9ba”,func=”Shiva::Object::BaseOrder::CancelReplaceOrder”,args=[{name=”this”,value=”0xffffddb0″}],file=”./Object/BaseOrder.h”,fullname=”/data/build/Shiva/Object/BaseOrder.h”,line=”207″},name=”var2″,numchild=”0″,value=””,type=”TradeExchange::OrdStatusEnum”,thread-id=”1″,has_more=”0″
    [ 16665 ms] -var-create –frame 0 –thread 1 – * “exrep->OrderStatus()”
    [ 16692 ms] ^error,msg=”-var-create: unable to create variable object”
    [ 18277 ms] -exec-continue
    [ 18278 ms] ^running
    [ 18278 ms] *running,thread-id=”all”
    [ 18329 ms] ~”[Thread 0x7fffa2ffd700 (LWP 13242) exited]\n”
    [ 18329 ms] =thread-exited,id=”9″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fff66d66700 (LWP 13252) exited]\n”
    [ 18329 ms] =thread-exited,id=”13″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffa27fc700 (LWP 13243) exited]\n”
    [ 18329 ms] =thread-exited,id=”10″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffa37fe700 (LWP 13241) exited]\n”
    [ 18329 ms] =thread-exited,id=”8″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffa3fff700 (LWP 13240) exited]\n”
    [ 18329 ms] =thread-exited,id=”7″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffb0df5700 (LWP 13239) exited]\n”
    [ 18329 ms] =thread-exited,id=”6″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffb15f6700 (LWP 13238) exited]\n”
    [ 18329 ms] =thread-exited,id=”5″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffb1df7700 (LWP 13237) exited]\n”
    [ 18329 ms] =thread-exited,id=”4″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffb25f8700 (LWP 13236) exited]\n”
    [ 18329 ms] =thread-exited,id=”3″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7fffb2df9700 (LWP 13235) exited]\n”
    [ 18329 ms] =thread-exited,id=”2″,group-id=”i1″
    [ 18329 ms] ~”[Thread 0x7ffff7fe4840 (LWP 13217) exited]\n”
    [ 18329 ms] =thread-exited,id=”1″,group-id=”i1″
    [ 18333 ms] ~”\nProgram terminated with signal ”
    [ 18333 ms] ~”SIGSEGV, Segmentation fault.\n”
    [ 18333 ms] ~”The program no longer exists.\n”
    [ 18333 ms] =thread-exited,id=”12″,group-id=”i1″
    [ 18333 ms] =thread-group-exited,id=”i1″
    [ 18333 ms] *stopped,reason=”exited-signalled”,signal-name=”SIGSEGV”,signal-meaning=”Segmentation fault”
    [ 18337 ms] -break-delete 2
    [ 18337 ms] ^done
    [ 18337 ms] -gdb-exit
    [ 18349 ms] ^exit

    gdb 7.10 and gdb 7.8.2 same

    #8004
    Char
    Participant

    if i add watch by pivate field all ok

    order->_cancelReplaceOrder->_orderStatus

    errorn and debug stop only if i use public const getter

    order->CancelReplaceOrder()->OrderStatus()”

    BaseOrder * CancelReplaceOrder() const {return _cancelReplaceOrder; }

    TradeExchange::OrdStatusEnum OrderStatus() const { return _orderStatus; }

    #8005
    support
    Keymaster

    Hi,

    This comes from the gdb’s implementation of running functions in Watch expressions. It runs them ‘as is’ and does not check for things like null pointers.

    Evaluating functions in-place is a powerful debugging feature, but it needs to be used carefully as there is no 100% safe way to run arbitrary functions in native code without potentially crashing the program.

    #8007
    Char
    Participant

    Yeah.

    Can VisualGDB handle this  signal and show error – “Watch variables error – segfault file line etc..”   because now it just stop debug session without any message why it happens.

    Or maybe it can convert property getters to class fields when add it to watch?

    its not simple to see getter value in debugger – for example mouse hover looks like that

     

    #8011
    support
    Keymaster

    Hi,

    The problem is that this behavior is defined inside the gdb itself and the only way to override it would be via modifying the gdb sources. As there are many different platforms where gdb runs, maintaining such a modified version would be unsustainable.

    VisualGDB does not show getters by design – to avoid accidentally invoking some function that may crash your program. If you want to get more usable display of your variables and fields, you can create .natvis files defining how to extract meaningful information from complex objects.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.