1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Segmentation Fault

Discussion in 'Help' started by DiamondGamer30, Aug 16, 2018.

  1. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    Does anyone know any software that I can install on my Ubuntu server to help me debug a segmentation fault? And also how to use it.
     
  2. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    apport-bug program-cmd --save bug-report_output.txt
     
  3. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    Please be more descriptive.
     
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    you could try to use gdb. Afaik I know it is pre-installed on Ubuntu, but in the case it is not a simple apt-get install gdb should do.
    To use it, make sure to compile the program you want to debug with debug (no optimisations). Then just enter the following commands in order:
    Code:
    gdb
    // Note that at this point you will have the gdb "console"
    file /absolute/path/to/the/executable/with/debug/symbols
    run -any --args --that might -be needed
    
    gdb should detect the segfault and give you a backtrace with function names and pointers
     
  5. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    Open command line and execute the command
     
  6. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    It doesn't seem like gdb supports PHP tho.
     
  7. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    gdb supports any C executable. php is a c executable. Of course you are not going to get a direct php line and function where the segfault happened, but having the backtrace of the php functions should give you insight.
     
  8. Destroyer57

    Destroyer57 Zombie

    Messages:
    275
    apport-bug program-cmd --save bug-report_output.txt this does
     
  9. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    Code:
    (gdb) file /home/servers/faction/1/plugins/PlexFacCore/src/core/koth/task/RunGameTask.php
    "/home/servers/faction/1/plugins/PlexFacCore/src/core/koth/task/RunGameTask.php": not in executable format: File format not recognized
    
     
  10. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    php files are not executables. You need to run the php executable through gdb.
    In your case:
    Code:
    gdb
    // Note that at this point you will have the gdb "console"
    file /home/servers/faction/1/bin/php7/bin/php
    run -r /home/servers/faction/1/src/pocketmine/PocketMine.php
    //This is assuming you have a src, if you have a PocketMine.phar please let me know.
    
     
    EdwardHamHam likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.