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.  gdb gcore support for AIX

    Posted Fri February 24, 2017 05:28 AM

    Originally posted by: sanket


    gdb with gcore support for AIX is now available on AIX toolbox.

    https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/gdb/gdb-7.9.1-6.aix6.1.ppc.rpm

    gcore subcommand is now supported in AIX gdb.
    Running gcore subcommand on gdb produces the core in the form of core.<process id>.
    Optional file name can be give to gcore command as well.

     

    Example:

    (gdb) br main
    Breakpoint 1 at 0x1000053c: file test.c, line 18.
    (gdb) gcore
    You can't do that without a process to debug. <= Process must be
    running for this command to work
    (gdb) r
    Starting program: /tmp/test

    Breakpoint 1, main () at test.c:18
    18 int i = 1;
    (gdb) disassemble main
    Dump of assembler code for function main:
    0x0000000100000528 <+0>: mflr r0
    0x000000010000052c <+4>: std r0,16(r1)
    0x0000000100000530 <+8>: std r31,-8(r1)
    0x0000000100000534 <+12>: stdu r1,-144(r1)
    0x0000000100000538 <+16>: mr r31,r1
    => 0x000000010000053c <+20>: li r9,1 <= Current PC
    0x0000000100000540 <+24>: stw r9,112(r31)
    ...................
    End of assembler dump.

    (gdb) gcore
    Saved corefile 'core.10289432'
    0x0000000100000540 18 int i = 1;
    (gdb) disassemble main
    Dump of assembler code for function main:
    0x0000000100000528 <+0>: mflr r0
    0x000000010000052c <+4>: std r0,16(r1)
    0x0000000100000530 <+8>: std r31,-8(r1)
    0x0000000100000534 <+12>: stdu r1,-144(r1)
    0x0000000100000538 <+16>: mr r31,r1
    0x000000010000053c <+20>: li r9,1
    => 0x0000000100000540 <+24>: stw r9,112(r31) <= Current PC after
    gcore
    0x0000000100000544 <+28>: addi r9,r31,112
    ..................
    End of assembler dump.

    (gdb) s
    20 foo(&i);
    (gdb) gcore test_core
    Saved corefile 'test_core'
    0x0000000100000548 20 foo(&i);
    (gdb) disassemble
    Dump of assembler code for function main:
    ...................
    0x0000000100000544 <+28>: addi r9,r31,112
    => 0x0000000100000548 <+32>: mr r3,r9
    0x000000010000054c <+36>: bl 0x1000004bc <foo>
    ...................
    End of assembler dump.

     



  • 2.  RE: gdb gcore support for AIX

    Posted Thu November 11, 2021 11:32 AM
    Wondering whether this topic would still be attended...

    If so:  I'm trying this, but getting

    (gdb) warning: cannot close "core.5964642": Invalid operation
    Can't create a corefile

    Any clue what this would mean, and what remedy?

    ------------------------------
    Andreas Legner
    ------------------------------



  • 3.  RE: gdb gcore support for AIX

    Posted Fri November 12, 2021 04:03 AM
    Hi Andreas,

    could you let me know the exact steps you are trying and example program ?

    ------------------------------
    SANGAMESH
    ------------------------------



  • 4.  RE: gdb gcore support for AIX

    Posted Fri November 12, 2021 11:48 AM
    Hi Sangamesh, and thanks for quick feedback first!

    I'm actually a step further now, after upgrading my gdb to v8.1.1 (from toolbox), and no longer getting "Invalid operation  Can't create a corefile".
    In fact, with a 'standard' program I'm now able to create a core dump, but when trying the same with a full fledged database server process (root owned s-bit binary) I'm only getting "gencore failed".

    The command I'm running is:

    echo gcore | gdb  /proc/$PID/object/a.out  $PID

    For the s-bit binary I'm doing this as root user.

    What I'm actually working on is a /usr/bin/gcore command (script) invoking the above command, for some sort of feature parity with other platforms like Linux, Solaris or HP-UX where /usr/bin/gcore is a built-in utility.

    Any clues highly appreciated! :-)

    BR,
     Andreas

    ------------------------------
    Andreas Legner
    ------------------------------



  • 5.  RE: gdb gcore support for AIX

    Posted Mon November 15, 2021 09:29 AM
    Hi Andreas,

    This implementation is very limited and doesn't provide the complete functionality which Linux provides.
    There are some missing functionality which aren't present.
    We don't have any plans right now to provide a full functionality like other distros.

    ------------------------------
    SANGAMESH
    ------------------------------