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

add instructions on quick/easy debugging steps for users who file tickets #1093

Open
eyberg opened this issue Mar 24, 2020 · 1 comment
Open

Comments

@eyberg
Copy link
Contributor

eyberg commented Mar 24, 2020

  • ops profile (other env stuff?)
  • repro steps
  • nightly vs master?
@oaktree11
Copy link

A c based user application on QEMU in Ubuntu can be debugged in Eclipse c++. The kernel can also be debugged -see below
1.Eclipse -new project- makefile project with existing code
2. Right click on the project in the project explorer debug configuration -remote application.
In the main tab:
c/c++ application:
select /output/test/runtime/bin/creat (for the creat example)
select manual debug launcher ( option is at the bottom left corner of the dialog)
debugger->main tab:
stop at startup : main
I have gdb-multiarch in the gdb debugger text box (normal gdb does not seem to work when debugging the kernel).
debugger->connection:
port:1234 (this is for qemu)

  1. start qemu in debug mode see here https://github.com/nanovms/nanos/wiki/using-the-qemu-remote-gdb-interface
  2. starting debugging in eclipse -> open the debug configuration dialog

To debug the kernel use
/output/stage3/bin/stage3.img as c++ application

For the creat example ( calls into kernel with the creat call which calls open_internal)
use open_internal as stop at startup option

There will be no symbols for the user application but we can load them using the gdb console once debugging has started.
at the (gdb) prompt using the add-symbol-file command
add-symbol-file path to /nanos/output/image/test/creat 0x77777777....
the 0x77777.... is the address of the text section in the user application, which can be obtained using readelf. see here for example- https://stackoverflow.com/questions/21508357/the-address-where-filename-has-been-loaded-is-missing-gdb
There will be no symbols for libc but these should be available with libc source linked to the app - I have not tried this.

Ideally we should have one elf "binary symbols file" that can be used to debug both the user app, libc and the kernel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants