Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arc gdb failed to load core dump file #26362

Closed
clear-zhang opened this issue Jun 23, 2020 · 13 comments
Closed

arc gdb failed to load core dump file #26362

clear-zhang opened this issue Jun 23, 2020 · 13 comments
Assignees
Labels
area: ARC ARC Architecture area: Debugging bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@clear-zhang
Copy link

clear-zhang commented Jun 23, 2020

Describe the bug
Wen we try to use gdb for arc cpu to load core dump file. Below error occurs:
"/home/clzhang/cxx_ww14/pxx/tmp/coredump.elf": no core file handler recognizes format

clzhang@clzhang-jlf-simics:~/cxx_ww14/pxx$ arc-zephyr-elf-gdb ./pub/cvf/arc/fpga_em7d_fw/zephyr.elf tmp/coredump.elf
GNU gdb (crosstool-NG 1.24.0-rc2-dirty) 8.2.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 "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
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 ./pub/cxx/arc/fpga_exxx_fw/zephyr.elf...done.
"/home/clzhang/cxx_ww14/pxx/tmp/coredump.elf": no core file handler recognizes format
(gdb)

To Reproduce
Steps to reproduce the behavior:

  1. In application, do a null pointer operation.
  2. in fatal.c, dump a core dump file
  3. run arc-zephyr-elf-gdb command for arc in SDk: arc-zephyr-elf-gdb ./pub/cvf/axx/fpga_exxx_fw/zephyr.elf tmp/coredump.elf
  4. See error

Expected behavior
core dump file is recognized and loaded.

Impact
It's high since it is blocking core dump feature development.

Screenshots or console output

clzhang@clzhang-jlf-simics:~/cxx_ww14/pxx$ arc-zephyr-elf-gdb ./pub/cvf/axx/fpga_exxx_fw/zephyr.elf tmp/coredump.elf
GNU gdb (crosstool-NG 1.24.0-rc2-dirty) 8.2.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 "--host=x86_64-build_pc-linux-gnu --target=arc-zephyr-elf".
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 ./pub/cxx/arc/fpga_exxx_fw/zephyr.elf...done.
"/home/clzhang/cvf_ww14/pse/tmp/coredump.elf": no core file handler recognizes format
(gdb)

Environment (please complete the following information):

  • OS: Linux
  • Toolchain (e.g Zephyr SDK, ...)
  • clzhang@clzhang-jlf-simics:~/cxx_ww14/pxx$ /opt/zephyr-sdk/arc-zephyr-elf/bin/arc-zephyr-elf-gdb --version
    GNU gdb (crosstool-NG 1.24.0-rc2-dirty) 8.2.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.

Additional context
Add any other context about the problem here.

@clear-zhang clear-zhang added the bug The issue is a bug, or the PR is fixing a bug label Jun 23, 2020
@clear-zhang
Copy link
Author

coredump.txt
this is a core dump file created by me. please change it as *.elf

@wentongwu wentongwu reopened this Jun 23, 2020
@wentongwu
Copy link
Contributor

@galak

@wentongwu wentongwu added the priority: medium Medium impact/importance bug label Jun 29, 2020
@clear-zhang
Copy link
Author

I found arc-linux-gdb has no this problem while arc-elf-gdb has. Seems it's caused by the different target option when gbd is built. Hope this can provide information for you

@ruuddw
Copy link
Member

ruuddw commented Jul 13, 2020

Thanks @clear-zhang, this helps (and would be a workaround for now). The tools team told me earlier this was a feature they added specifically for Linux core dumps, so maybe indeed a matter of setting the right flags when building - will check with them.

@shahab-vahedi
Copy link

@clear-zhang thanks for all the detailed info. Indeed, arc-linux-gdb is able to parse those coredumps, because that was the foreseeable scenario:

  1. A userspace program running inside GNU/Linux OS coredumps.
  2. arc-linux-gdb must be able to parse it.

For now, please continue using arc-linux-gdb. If you run into any trouble, please do let me know.

Track the implementation of the feature is here.

@galak
Copy link
Collaborator

galak commented Jul 22, 2020

Need someone from the arc side to comment on if there are changes/patches that ARC is support for GDB for this.

@shahab-vahedi
Copy link

To Reproduce
Steps to reproduce the behavior:

1. In application, do a null pointer operation.

2. in fatal.c, dump a core dump file

3. run arc-zephyr-elf-gdb command for arc in SDk: arc-zephyr-elf-gdb ./pub/cvf/axx/fpga_exxx_fw/zephyr.elf tmp/coredump.elf

4. See error

I cannot get the coredump generated. What do you exactly mean by step 2? I looked a little bit into ARC's fatal.c and thought maybe I should have ARC_EXCEPTION_DEBUG enabled, but that didn't change anything.

I know you have provided the coredump, but I rather use one that comes from the elf file I have. For now, I am actually using the provided coredump against an arbitrary zephyr.elf.

To be complete, I used this Zephyr.

@shahab-vahedi
Copy link

shahab-vahedi commented Jul 28, 2020

I looked into other targets such as ARM. From the code, it looks like gdb should behave the same for them: *-elf*-gdb is not able to parse the coredump while the *-linux-gdb is.

Could someone tell me how the elf gdb behave for other targets? Or even better, tell me how to generate coredumps so I can do it for other targets and debug those GDBs myself.

@galak
Copy link
Collaborator

galak commented Jul 28, 2020

Thanks @clear-zhang, this helps (and would be a workaround for now). The tools team told me earlier this was a feature they added specifically for Linux core dumps, so maybe indeed a matter of setting the right flags when building - will check with them.

@ruuddw let me know and I can update the build configuration in the Zephyr SDK for ARC.

@abrodkin
Copy link
Collaborator

@clear-zhang @galak let's first make it a bit more clear what is the problem here. For instance I don't quite understand how that core dump is supposed to be created? Which target is used for that, how do we interact with that target. In case of the Linux-based OS core dump is being created by the kernel itself and gets put on the filesystem. How that could be done in case of Zephyr is not clear to me.

@galak galak added priority: low Low impact/importance bug and removed priority: medium Medium impact/importance bug labels Aug 4, 2020
@galak
Copy link
Collaborator

galak commented Aug 4, 2020

Lower priority as @abrodkin mentioned I don't see how a core dump could even be generated w/Zephyr.

@ruuddw
Copy link
Member

ruuddw commented Aug 14, 2020

@clear-zhang Can you please explain how you generated the coredump? Did you dump it from gdb (generate-core-file) or so?

@abrodkin
Copy link
Collaborator

abrodkin commented Sep 7, 2020

I'm closing it now since we don't really understand what's the problem here and for more than a month there were no updates with clarification. Feel free to re-open it once more info is avaialble.

@abrodkin abrodkin closed this as completed Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARC ARC Architecture area: Debugging bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

8 participants