[gem5-dev] Re: Debugging application inside gem5 (m5term)

2020-05-20 Thread GAURAV JAIN via gem5-dev
Hi Ciro,
 runn
Thanks for the response. Yeah, even we couldn't make the gdbserver approach 
work.

For the non-gdbserver approach you described, we tried it but we are still not 
able to hit the breakpoints on the app (by running gdb on the host system).

I think I might have missed this earlier but using gdb inside m5term with the 
application is not an issue and works perfectly fine. It was that the libraries 
I was trying to step into didn't contain debug symbols on the guest OS, I 
thought connecting it with the host gdb and debugging the application on the 
host would be a better approach. (because on the host, I have seen that a few, 
if not all of the libraries, have been built with debug symbols)


Thanks,
Gaurav

From: ciro.santi...@gmail.com 
Sent: Tuesday, May 19, 2020 3:24 PM
To: gem5 Developer List 
Cc: Beckmann, Brad ; GAURAV JAIN 
Subject: Re: [gem5-dev] Debugging application inside gem5 (m5term)

For the gdbserver approach, I haven't found a guest to host networking
possibility in gem5 yet:
https://stackoverflow.com/questions/48941494/how-to-do-port-forwarding-from-guest-to-host-and-vice-versa-in-gem5
but maybe I missed it.

For a non-gdbserver approach, have you tried add-symbol-file as
mentioned at 
https://stackoverflow.com/questions/26271901/is-it-possible-to-use-gdb-and-qemu-to-debug-linux-user-space-programs-and-kernel/46636070#46636070
and 
https://stackoverflow.com/questions/20380204/how-to-load-multiple-symbol-files-in-gdb

BTW, have a look into lx-symbols to help with kernel modules in case
you are not using it yet:
https://cirosantilli.com/linux-kernel-module-cheat/#gdb-step-debug-kernel-module

BTW2 Dealing with userland apps perfectly from gem5 GDB stub
(including multiple userland programs with same address) asked at:
https://stackoverflow.com/questions/9561546/thread-aware-gdb-for-the-linux-kernel

On Tue, May 19, 2020 at 8:03 PM GAURAV JAIN via gem5-dev
 wrote:
>
> Hi All,
>
> We are trying to debug an application running inside gem5 full system.
>
> After running gem5, we are using 'gdb vmlinux' to attach to it so as to be 
> able to debug the kernel modules.
>
> One approach we tried was using the 'file' command to load the symbol table 
> for the application and continue. But then that approach would overwrite the 
> existing symbol table (for the kernel modules) with that of the application 
> which is not what we desire.
>
> The second approach we tried was running 'gdbserver' inside m5term and then 
> connect to it through a gdb instance running on the host.
>
> We did - 'gdbserver localhost:1234 ./app', which seemed to be successful in 
> launching a process and Listening on the port 1234.
>
> On the host, we did - 'gdb ./app' and from inside it, 'target remote :1234'.
> Doing this did not work and we got the generic error - 'remote:1234 
> connection timed out'
>
> It'd be great if someone could provide pointers on how can we debug an 
> application running in gem5 full system and if either of the two approaches 
> mentioned above would work.
>
> Thanks,
> Gaurav
> ___
> gem5-dev mailing list -- gem5-dev@gem5.org
> To unsubscribe send an email to gem5-dev-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s


[gem5-dev] Debugging application inside gem5 (m5term)

2020-05-19 Thread GAURAV JAIN via gem5-dev
Hi All,

We are trying to debug an application running inside gem5 full system.

After running gem5, we are using 'gdb vmlinux' to attach to it so as to be able 
to debug the kernel modules.

One approach we tried was using the 'file' command to load the symbol table for 
the application and continue. But then that approach would overwrite the 
existing symbol table (for the kernel modules) with that of the application 
which is not what we desire.

The second approach we tried was running 'gdbserver' inside m5term and then 
connect to it through a gdb instance running on the host.

We did - 'gdbserver localhost:1234 ./app', which seemed to be successful in 
launching a process and Listening on the port 1234.

On the host, we did - 'gdb ./app' and from inside it, 'target remote :1234'.
Doing this did not work and we got the generic error - 'remote:1234 connection 
timed out'

It'd be great if someone could provide pointers on how can we debug an 
application running in gem5 full system and if either of the two approaches 
mentioned above would work.

Thanks,
Gaurav
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s