Open Source Development

Power Open Source Development

Explore the open source tools and capabilities for building and deploying modern applications on IBM Power platforms including AIX, IBM i, and Linux.


#Power


#Power

 View Only
Expand all | Collapse all

gdb can not find frame base error

  • 1.  gdb can not find frame base error

    Posted Wed July 24, 2019 12:24 PM

    Originally posted by: appd


    We are unable to set a breakpoint in quite a simple test program (or any other) due to gdb being unable to find the frame.

     

    Can anybody give any pointers as to what the issue may be?

     

    Run test program on AIX: ./a.out

    Input string is : testuser@customer1: credential

    Encoded string is : zZabnVcbhSda0ZdLhXZZuUcQjVfc0f ZblSdM6DWS1CaMtXMZxELM1EM=

     

     

    Compile command

     g++ en.cpp -g -gdb3 -std=c++11

     

    Run command

    gdb a.out

     

    Break at function " _to_base64". And then do bt.

     

     

     

    Error :   Could not find the frame base for "_to_base64

     

     

    Tried to increase stack size (based on a google search for this error) but that did not resolve the issue.

    LDR_CNTRL=MAXDATA=0XB0000000@ DSA@TEXTPSIZE=4K@STACKPSIZE= 64K@DATAPSIZE=64K

     

     

     

    (gdb) bt

    #0  _to_base64[abi:cxx11](unsigned char const*, unsigned long) (ptr=<error reading variable: Could not find the frame base for "_to_base64[abi:cxx11]( unsigned char const*, unsigned long)".>,

       size=<error reading variable: Could not find the frame base for "_to_base64[abi:cxx11]( unsigned char const*, unsigned long)".>) at en.cpp:42

    #1  0x10000be8 in main () at en.cpp:102

    warning: (Internal error: pc 0x100002d3 in read in psymtab, but not in symtab.)

     

    warning: (Internal error: pc 0x100002d4 in read in psymtab, but not in symtab.)

     

    Full source code of test program is below:

     

    #include <iostream>
    using namespace std;

     

    struct _triple_byte
    {
        unsigned char _0   : 6;
        unsigned char _1_1 : 2;
        unsigned char _1_2 : 4;
        unsigned char _2_1 : 4;
        unsigned char _2_2 : 2;
        unsigned char _3   : 6;
    };
     
    struct _double_byte
    {
        unsigned char _0   : 6;
        unsigned char _1_1 : 2;
        unsigned char _1_2 : 4;
        unsigned char _2_1 : 4;
    };
     
    struct _single_byte
    {
        unsigned char _0   : 6;
        unsigned char _1_1 : 2;
    };

     

     

    static const char* _base64_enctbl = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcd efghijklmnopqrstuvwxyz01234567 89+/";
    string _to_base64(const unsigned char* ptr, size_t size)
    {
        string result;

     

        for (; size >= 3;)
        {
            const _triple_byte* record = reinterpret_cast<const _triple_byte*>(ptr);
            unsigned char idx0 = record->_0;
            unsigned char idx1 = (record->_1_1 << 4) | record->_1_2;
            unsigned char idx2 = (record->_2_1 << 2) | record->_2_2;
            unsigned char idx3 = record->_3;
            result.push_back(char(_base64_ enctbl[idx0]));
            result.push_back(char(_base64_ enctbl[idx1]));
            result.push_back(char(_base64_ enctbl[idx2]));
            result.push_back(char(_base64_ enctbl[idx3]));
            size -= 3;
            ptr += 3;
        }
        switch (size)
        {
            case 1:
            {
                const _single_byte* record = reinterpret_cast<const _single_byte*>(ptr);
                unsigned char idx0 = record->_0;
                unsigned char idx1 = (record->_1_1 << 4);
                result.push_back(char(_base64_ enctbl[idx0]));
                result.push_back(char(_base64_ enctbl[idx1]));
                result.push_back('=');
                result.push_back('=');
                break;
            }
            case 2:
            {
                const _double_byte* record = reinterpret_cast<const _double_byte*>(ptr);
                unsigned char idx0 = record->_0;
                unsigned char idx1 = (record->_1_1 << 4) | record->_1_2;
                unsigned char idx2 = (record->_2_1 << 2);
                result.push_back(char(_base64_ enctbl[idx0]));
                result.push_back(char(_base64_ enctbl[idx1]));
                result.push_back(char(_base64_ enctbl[idx2]));
                result.push_back('=');
                break;
            }
        }
        return result;
    }

     

    // Driver code
    int main()
    {
            unsigned char input_str[] = "testuser@customer1: credential";
            int len_str;

     

            // calculates length of string
            len_str = sizeof(input_str) / sizeof(input_str[0]);

           

            // to exclude '\0' character
            len_str -= 1;

     

            printf("Input string is : %s\n", input_str);
            printf("Encoded string is : %s\n", (_to_base64(input_str, len_str)).c_str());
            return 0;
    }

     


    #AIX-Open-Source-Software
    #AIXOpenSource


  • 2.  Re: gdb can not find frame base error

    Posted Wed August 07, 2019 02:18 AM

    Originally posted by: sangameshm


    Sorry for the delay in reply.

    Will check this and get back to you soon.

     

    thanks,

    Sangamesh


    #AIXOpenSource
    #AIX-Open-Source-Software