Skip to content

unable to debug malloc_shared with gdb #4331

@alexbatashev

Description

@alexbatashev

Discussed in #4330

Originally posted by guoyejun August 13, 2021
Hi,

I'm trying the hello world code of DPCPP book, and I tried the code at https://github.com/Apress/data-parallel-CPP/blob/main/samples/Ch01_intro/fig_1_1_hello.cpp, but met crash when debug the program with gdb, see below. I also tried with .../intel/oneapi/debugger/10.1.2/gdb/intel64/bin/gdb-oneapi, the same issue.

$ dpcpp -g fig_1_1_hello.cpp
$ gdb ./a.out
GNU gdb (Ubuntu 9.1-0ubuntu1) 9.1
Copyright (C) 2020 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 "x86_64-linux-gnu".
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 ./a.out...
(gdb) r
Starting program: /home/yjguo/work/ooo/dpcpp/a.out
warning: File "/home/yjguo/intel/oneapi/compiler/2021.3.0/linux/lib/libsycl.so.5.2.0-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /home/yjguo/intel/oneapi/compiler/2021.3.0/linux/lib/libsycl.so.5.2.0-gdb.py
line to your configuration file "/home/yjguo/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/yjguo/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff31e3700 (LWP 64327)]
[New Thread 0x7ffff1bd9700 (LWP 64328)]

Thread 1 "a.out" received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
65      ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
#1  0x00007ffff7f02b1e in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#2  0x00000000004037ef in main () at fig_1_1_hello.cpp:25
(gdb) f 2
#2  0x00000000004037ef in main () at fig_1_1_hello.cpp:25
25        std::cout << result << "\n";
(gdb) p result
$1 = 0x7ffff0c00000 "Ifmmp-!xpsme\"\nJ(n!tpssz-!Ebwf/!J(n!bgsbje!J!dbo(u!ep!uibu/!.!IBM\001"
(gdb)

btw, Intel gpu is selected by the queue as default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions