• dpdk gdb debug 编译选项 export EXTRA_CFLAGS="-O0 -g"


    [root@localhost memzone]# gdb build/app/helloworld /data1/core/corefile-helloworld-56592-1598942035
    GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
    Copyright (C) 2013 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 "aarch64-redhat-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /data1/dpdk-19.11/demo/memzone/build/app/helloworld...done.
    [New LWP 56592]
    [New LWP 56595]
    [New LWP 56594]
    [New LWP 56596]
    [New LWP 56593]
    [New LWP 56597]
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    Core was generated by `build/app/helloworld -c 0xf -n 4 --proc-type=primary'.
    Program terminated with signal 11, Segmentation fault.
    #0  0x000000000047eb94 in main (argc=<optimized out>, argv=<optimized out>)
        at /data1/dpdk-19.11/demo/memzone/main.c:65
    65              arr[0]=4;
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-307.el7.1.aarch64 libgcc-4.8.5-39.el7.aarch64 numactl-libs-2.0.12-5.el7.aarch64
    (gdb) set args  -c 0xf -n 4 --proc-type=primary
    (gdb) r
    Starting program: /data1/dpdk-19.11/demo/memzone/build/app/helloworld -c 0xf -n 4 --proc-type=primary
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    EAL: Detected 128 lcore(s)
    EAL: Detected 4 NUMA nodes
    [New Thread 0xffffbe43d910 (LWP 56666)]
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    [New Thread 0xffffbdc2d910 (LWP 56667)]
    EAL: Selected IOVA mode 'PA'
    EAL: Probing VFIO support...
    EAL: VFIO support initialized
    [New Thread 0xffffbd40d910 (LWP 56668)]
    [New Thread 0xffffbcbfd910 (LWP 56669)]
    [New Thread 0xffffbc3ed910 (LWP 56670)]
    EAL: PCI device 0000:05:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    EAL:   using IOMMU type 1 (Type 1)
    net_hinic: Initializing pf hinic-0000:05:00.0 in primary process
    net_hinic: Device 0000:05:00.0 hwif attribute:
    net_hinic: func_idx:0, p2p_idx:0, pciintf_idx:0, vf_in_pf:0, ppf_idx:0, global_vf_id:15, func_type:2
    net_hinic: num_aeqs:4, num_ceqs:4, num_irqs:32, dma_attr:2
    net_hinic: Get public resource capability:
    net_hinic: host_id: 0x0, ep_id: 0x0, intr_type: 0x0, max_cos_id: 0x7, er_id: 0x0, port_id: 0x0
    net_hinic: host_total_function: 0xf2, host_oq_id_mask_val: 0x8, max_vf: 0x78
    net_hinic: pf_num: 0x2, pf_id_start: 0x0, vf_num: 0xf0, vf_id_start: 0x10
    net_hinic: Get share resource capability:
    net_hinic: host_pctxs: 0x0, host_cctxs: 0x0, host_scqs: 0x0, host_srqs: 0x0, host_mpts: 0x0
    net_hinic: Get l2nic resource capability:
    net_hinic: max_sqs: 0x10, max_rqs: 0x10, vf_max_sqs: 0x4, vf_max_rqs: 0x4
    net_hinic: Initialize 0000:05:00.0 in primary successfully
    EAL: PCI device 0000:06:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    EAL: PCI device 0000:7d:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:a222 net_hns3
    EAL: PCI device 0000:7d:00.1 on NUMA socket 0
    EAL:   probe driver: 19e5:a221 net_hns3
    EAL: PCI device 0000:7d:00.2 on NUMA socket 0
    EAL:   probe driver: 19e5:a222 net_hns3
    EAL: PCI device 0000:7d:00.3 on NUMA socket 0
    EAL:   probe driver: 19e5:a221 net_hns3
    mz addr: 100012838, mz->addr :42002bc780 , mz->addr_64 : 42002bc780
    arr addr: fffffffff3b0 
    arr addr: 2bb700 
    hello from core 1
    socket id  0
    hello from core 2
    socket id  0
    hello from core 3
    socket id  0
    
    Program received signal SIGSEGV, Segmentation fault.
    0x000000000047eb94 in main (argc=<optimized out>, argv=<optimized out>)
        at /data1/dpdk-19.11/demo/memzone/main.c:65
    65              arr[0]=4;
    (gdb) quit
    A debugging session is active.
    
            Inferior 1 [process 56662] will be killed.
    
    Quit anyway? (y or n) y
    [root@localhost memzone]# gdb build/app/helloworld /data1/core/corefile-helloworld-56592-1598942035
    GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
    Copyright (C) 2013 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 "aarch64-redhat-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /data1/dpdk-19.11/demo/memzone/build/app/helloworld...done.
    [New LWP 56592]
    [New LWP 56595]
    [New LWP 56594]
    [New LWP 56596]
    [New LWP 56593]
    [New LWP 56597]
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    Core was generated by `build/app/helloworld -c 0xf -n 4 --proc-type=primary'.
    Program terminated with signal 11, Segmentation fault.
    #0  0x000000000047eb94 in main (argc=<optimized out>, argv=<optimized out>)
        at /data1/dpdk-19.11/demo/memzone/main.c:65
    65              arr[0]=4;
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-307.el7.1.aarch64 libgcc-4.8.5-39.el7.aarch64 numactl-libs-2.0.12-5.el7.aarch64
    (gdb) bt
    #0  0x000000000047eb94 in main (argc=<optimized out>, argv=<optimized out>)
        at /data1/dpdk-19.11/demo/memzone/main.c:65
    (gdb) 

    Breakpoint 1, main (argc=4, argv=0xfffffffff528) at /data1/dpdk-19.11/demo/memzone/main.c:52
    52              arr = rte_malloc("arr", sizeof(int) * 1024, 0);
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-307.el7.1.aarch64 libgcc-4.8.5-39.el7.aarch64 numactl-libs-2.0.12-5.el7.aarch64

    1、编译dpdk

    export EXTRA_CFLAGS="-O0 -g"
    export RTE_TARGET=arm64-armv8a-linuxapp-gcc
    export RTE_SDK=`pwd`

    make  install  T=$RTE_TARGET -j 128

    2、编译项目

      export EXTRA_CFLAGS="-O0 -g"
      make clean all

    [root@localhost memzone]# gdb  build/app/TestMalloc 
    GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-119.el7
    Copyright (C) 2013 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 "aarch64-redhat-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc...done.
    (gdb) set args 3  -c 0xff  
    (gdb) b main.c:52
    Breakpoint 1 at 0x464dd4: file /data1/dpdk-19.11/demo/memzone/main.c, line 52.
    (gdb) r
    Starting program: /data1/dpdk-19.11/demo/memzone/build/app/TestMalloc 3  -c 0xff  
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    socket id 3 
    EAL: Detected 128 lcore(s)
    EAL: Detected 4 NUMA nodes
    [New Thread 0xffffbe43d910 (LWP 100263)]
    EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
    [New Thread 0xffffbdc2d910 (LWP 100264)]
    EAL: Selected IOVA mode 'PA'
    EAL: No available hugepages reported in hugepages-2048kB
     EAL: Probing VFIO support...
    EAL: VFIO support initialized
    [New Thread 0xffffbd40d910 (LWP 100265)]
    [New Thread 0xffffbcbfd910 (LWP 100266)]
    [New Thread 0xffffbc3ed910 (LWP 100267)]
    [New Thread 0xffffbbbdd910 (LWP 100268)]
    [New Thread 0xffffbb3cd910 (LWP 100269)]
    [New Thread 0xffffbabbd910 (LWP 100270)]
    [New Thread 0xffffba3ad910 (LWP 100271)]
    EAL: PCI device 0000:05:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    EAL:   using IOMMU type 1 (Type 1)
    net_hinic: Initializing pf hinic-0000:05:00.0 in primary process
    net_hinic: Device 0000:05:00.0 hwif attribute:
    net_hinic: func_idx:0, p2p_idx:0, pciintf_idx:0, vf_in_pf:0, ppf_idx:0, global_vf_id:15, func_type:2
    net_hinic: num_aeqs:4, num_ceqs:4, num_irqs:32, dma_attr:2
    net_hinic: Get public resource capability:
    net_hinic: host_id: 0x0, ep_id: 0x0, intr_type: 0x0, max_cos_id: 0x7, er_id: 0x0, port_id: 0x0
    net_hinic: host_total_function: 0xf2, host_oq_id_mask_val: 0x8, max_vf: 0x78
    net_hinic: pf_num: 0x2, pf_id_start: 0x0, vf_num: 0xf0, vf_id_start: 0x10
    net_hinic: Get share resource capability:
    net_hinic: host_pctxs: 0x0, host_cctxs: 0x0, host_scqs: 0x0, host_srqs: 0x0, host_mpts: 0x0
    net_hinic: Get l2nic resource capability:
    net_hinic: max_sqs: 0x10, max_rqs: 0x10, vf_max_sqs: 0x4, vf_max_rqs: 0x4
    net_hinic: Initialize 0000:05:00.0 in primary successfully
    EAL: PCI device 0000:06:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:200 net_hinic
    EAL: PCI device 0000:7d:00.0 on NUMA socket 0
    EAL:   probe driver: 19e5:a222 net_hns3
    EAL: PCI device 0000:7d:00.1 on NUMA socket 0
    EAL:   probe driver: 19e5:a221 net_hns3
    EAL: PCI device 0000:7d:00.2 on NUMA socket 0
    EAL:   probe driver: 19e5:a222 net_hns3
    EAL: PCI device 0000:7d:00.3 on NUMA socket 0
    EAL:   probe driver: 19e5:a221 net_hns3
    
    Breakpoint 1, main (argc=4, argv=0xfffffffff518) at /data1/dpdk-19.11/demo/memzone/main.c:52
    52              arr = rte_malloc("arr", sizeof(int) * 1024, 0);
    (gdb) s
    rte_malloc (type=0xba62e8 "arr", size=4096, align=0) at /data1/dpdk-19.11/lib/librte_eal/common/rte_malloc.c:70
    70              return rte_malloc_socket(type, size, align, SOCKET_ID_ANY);
    (gdb) s
    rte_malloc_socket (type=0xba62e8 "arr", size=4096, align=0, socket_arg=-1)
        at /data1/dpdk-19.11/lib/librte_eal/common/rte_malloc.c:48
    48              if (size == 0 || (align && !rte_is_power_of_2(align)))
    (gdb) n
    56              if (rte_malloc_heap_socket_is_external(socket_arg) != 1 &&
    (gdb) n
    57                                      !rte_eal_has_hugepages())
    (gdb) n
    56              if (rte_malloc_heap_socket_is_external(socket_arg) != 1 &&
    (gdb) n
    60              return malloc_heap_alloc(type, size, socket_arg, 0,
    (gdb) p *socket_arg
    Cannot access memory at address 0xffffffffffffffff
    (gdb) p *type
    $1 = 97 'a'
    (gdb) p size
    $2 = 4096
    (gdb) p type
    $3 = 0xba62e8 "arr"
    (gdb) s
    malloc_heap_alloc (type=0xba62e8 "arr", size=4096, socket_arg=-1, flags=0, align=1, bound=0, contig=false)
        at /data1/dpdk-19.11/lib/librte_eal/common/malloc_heap.c:699
    699             if (size == 0 || (align && !rte_is_power_of_2(align)))
    (gdb) n
    702             if (!rte_eal_has_hugepages() && socket_arg < RTE_MAX_NUMA_NODES)
    (gdb) p socket_arg
    $4 = -1
    (gdb) n
    705             if (socket_arg == SOCKET_ID_ANY)
    (gdb) n
    706                     socket = malloc_get_numa_socket();
    (gdb) n
    711             heap_id = malloc_socket_to_heap_id(socket);
    (gdb) n
    713             if (heap_id < 0)
    (gdb) p heap_id
    $5 = 0
    (gdb) n
    716             ret = malloc_heap_alloc_on_heap_id(type, size, heap_id, flags, align,
    (gdb) p ret
    $6 = (void *) 0x0
    (gdb) n
    718             if (ret != NULL || socket_arg != SOCKET_ID_ANY)
    (gdb) p ret
    $7 = (void *) 0x13febb800
    (gdb) n
    719                     return ret;
    (gdb) n
    733     }
    (gdb) list 
    728                                     bound, contig);
    729                     if (ret != NULL)
    730                             return ret;
    731             }
    732             return NULL;
    733     }
    734
    735     static void *
    736     heap_alloc_biggest_on_heap_id(const char *type, unsigned int heap_id,
    737                     unsigned int flags, size_t align, bool contig)
    (gdb) n
    rte_malloc_socket (type=0xba62e8 "arr", size=4096, align=0, socket_arg=-1)
        at /data1/dpdk-19.11/lib/librte_eal/common/rte_malloc.c:62
    62      }
    (gdb) n
    rte_malloc (type=0xba62e8 "arr", size=4096, align=0) at /data1/dpdk-19.11/lib/librte_eal/common/rte_malloc.c:71
    71      }
    (gdb) n
    main (argc=4, argv=0xfffffffff518) at /data1/dpdk-19.11/demo/memzone/main.c:53
    53              if (arr == NULL)
    (gdb) p arr
    $8 = (int *) 0x3febb800
    (gdb) n
    55              printf("arr addr %llx 
     ",(long long) arr);
    (gdb) n
    arr addr 3febb800 
    56              arr[0] = 1000;
    (gdb) n
    
    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000464e24 in main (argc=4, argv=0xfffffffff518) at /data1/dpdk-19.11/demo/memzone/main.c:56
    56              arr[0] = 1000;
    (gdb)
  • 相关阅读:
    Java编译期和运行期
    深入理解重载和重写及与之相关的多态性 Overloading and Overriding(转)
    Java编译期优化与运行期优化技术浅析
    JAVA反射
    JSP笔记(二)
    JSP笔记(一)
    字符串之String类
    JAVA的Random类介绍
    (转)详细分析css float 属性
    协议与委托
  • 原文地址:https://www.cnblogs.com/dream397/p/13596087.html
Copyright © 2020-2023  润新知