AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
  • 1.  Trouble attaching gdb on AIX

    Posted Fri June 21, 2019 11:28 AM

    Originally posted by: appd


    We are trying to debug a user-exit we have written for IBM's IIB product running on AIX.  We have compiled the user-exit into a shared library with gcc, and are trying to attach to the IIB process (called "DataFlowEgine") to allow us to single-step through our code.

    This is always unsuccessful, resulting in 1 of 2 errors (the 1st is the most common of the 2)

    I have put the relevant version information below the error details.

     

    Any pointers to help us resolve this would be very gratefully received!

     

    Error 1:
    bare-08$ ps -ef | grep Data
    teamcity 12648614  8519746   1 08:44:54  pts/0  0:00 grep Data
    teamcity 15597770 11862054   0 08:42:00      -  0:02 DataFlowEngine aix_node fc8ae91f-645a-402a-a352- d0a897a3c944 IServer
    bare-08$ gdb attach 15597770         
    GNU gdb (GDB) 8.1.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl. html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "powerpc64-ibm-aix6.1.0.0".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    Find the GDB manual and other documentation resources online at:
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    attach: No such file or directory.
    Attaching to process 15597770
    ptrace: No such process.
    /home/teamcity/15597770: No such file or directory.
    (gdb) 
     
    Error 2:
     
     ps -ef|grep Dat  
    teamcity 15597770 11862054   0 08:42:00      -  0:02 DataFlowEngine aix_node fc8ae91f-645a-402a-a352- d0a897a3c944 IServer
    bare-08$ gdb attach 15597770
    GNU gdb (GDB) 8.1.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl. html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "powerpc64-ibm-aix6.1.0.0".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    Find the GDB manual and other documentation resources online at:
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    attach: No such file or directory.
    Attaching to process 15597770
    PC register is not available
     
     
     
    Version Related INFO:
     
    gcc --version 
    gcc (GCC) 8.3.0
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
     
    gdb --version
    GNU gdb (GDB) 8.1.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl. html>
     
     
    uname -a
    AIX bare-08 1 7 00FA65BF4C00
     
     oslevel
    7.1.0.0
     
    ****************************** ****************************** *******************
    *                                                                             *
    *                                                                             *
    *  Welcome to AIX Version 7.1!                                                *
    *                                                                             *
    *                                                                             *
    *  Please see the README file in /usr/lpp/bos for information pertinent to    *
    *  this release of the AIX Operating System.                                  *
    *                                                                             *
    *                                                                             *
    ****************************** ****************************** *******************


  • 2.  Re: Trouble attaching gdb on AIX

    Posted Mon June 24, 2019 02:43 AM

    Originally posted by: sangameshm


    The correct way to attach a process to gdb is gdb <fiile> <pid>

    or we can use attach command inside the gdb prompt.

    # gdb /usr/sbin/sshd 6029580
    GNU gdb (GDB) 8.1.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "powerpc64-ibm-aix6.1.0.0".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from /usr/sbin/sshd...done.
    Attaching to program: /usr/sbin/sshd, process 6029580
    BFD: BFD (GNU Binutils) 2.29.51 assertion fail format.c:453

    warning: "/usr/lib/libdl.a": member "shr.o" missing.

    warning: Could not load shared library symbols for /usr/lib/libdl.a(shr.o).
    Do you need "set solib-search-path" or "set sysroot"?
    [New Thread 1]
    [Switching to Thread 1]
    0xd0277a8c in __fd_select () from /usr/lib/libc.a(shr.o)
    (gdb) bt
    #0  0xd0277a8c in __fd_select () from /usr/lib/libc.a(shr.o)
    #1  0x10002510 in select (__fds=7, __readlist=0x2005b988, __writelist=0x0,
        __exceptlist=0x0, __timeout=0x0)
        at time.h:234
    #2  0x100027b0 in server_accept_loop (sock_in=0x2ff22bfc, sock_out=0x2ff22c00,
        newsock=0x2ff22c04, config_s=0x2ff22c28) at sshd.c:1191
    #3  0x10004e68 in main (ac=2, av=0x20059ec8) at sshd.c:1960
    (gdb) q
    A debugging session is active.

            Inferior 1 [process 6029580] will be detached.

    Quit anyway? (y or n) y
    Detaching from program: /usr/sbin/sshd, process 6029580


    # gdb
    GNU gdb (GDB) 8.1.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "powerpc64-ibm-aix6.1.0.0".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    (gdb) attach 6029580
    Attaching to process 6029580
    warning: No executable has been specified and target does not support
    determining executable automatically.  Try using the "file" command.
    0xd0277a8c in ?? ()
    (gdb) bt
    #0  0xd0277a8c in ?? ()
    #1  0xffffffff in ?? ()
    #2  0x10002510 in ?? ()
    #3  0x100027b0 in ?? ()
    #4  0x10004e68 in ?? ()
    #5  0x100001ec in ?? ()
    (gdb) q
    A debugging session is active.

            Inferior 1 [process 6029580] will be detached.

    Quit anyway? (y or n) y
    Detaching from program: , process 6029580


    #

    # gdb
    GNU gdb (GDB) 8.1.1
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "powerpc64-ibm-aix6.1.0.0".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word".
    (gdb) file /usr/sbin/sshd
    Reading symbols from /usr/sbin/sshd...done.
    (gdb) attach 6029580
    Attaching to program: /usr/sbin/sshd, process 6029580
    BFD: BFD (GNU Binutils) 2.29.51 assertion fail format.c:453
    warning: "/usr/lib/libdl.a": member "shr.o" missing.
    warning: Could not load shared library symbols for /usr/lib/libdl.a(shr.o).
    Do you need "set solib-search-path" or "set sysroot"?
    [New Thread 1]
    [Switching to Thread 1]
    0xd0277a8c in __fd_select () from /usr/lib/libc.a(shr.o)
    (gdb) bt
    #0  0xd0277a8c in __fd_select () from /usr/lib/libc.a(shr.o)
    #1  0x10002510 in select (__fds=7, __readlist=0x2005b988, __writelist=0x0,
        __exceptlist=0x0, __timeout=0x0)
        at time.h:234
    #2  0x100027b0 in server_accept_loop (sock_in=0x2ff22bfc, sock_out=0x2ff22c00,
        newsock=0x2ff22c04, config_s=0x2ff22c28) at sshd.c:1191
    #3  0x10004e68 in main (ac=2, av=0x20059ec8) at sshd.c:1960
    (gdb)

     

    Try these steps and let us know how it goes.



  • 3.  Re: Trouble attaching gdb on AIX

    Posted Thu June 27, 2019 11:49 AM

    Originally posted by: appd


    Thank you!  I can't believe we didn't manage to figure that out ourselves.  RTFM.

    Sorry for the noise!