public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Linux kernel debugging - make scripts_gdb - Error
@ 2023-04-12 10:28 Little Tree
  2023-04-12 17:51 ` Luis Machado
  0 siblings, 1 reply; 2+ messages in thread
From: Little Tree @ 2023-04-12 10:28 UTC (permalink / raw)
  To: gdb

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]

I am remotely debugging an AArch64 Linux kernel running on QEMU using gdb.
I wish to make use of the Python support while debugging (for using the
commands like lx-dmesg).
Referring to this link
https://docs.kernel.org/dev-tools/gdb-kernel-debugging.html , I understand
that for Linux kernel 5.1 and above, the scripting support is to be built
using the command "make scripts_gdb" after the Linux kernel is built. I am
getting many errors while building (mostly related to x86).

Do I have to set any arm specific environment variable before building? At
present my build command is

$make scripts_gdb


Thanks a lot,
  Little

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Linux kernel debugging - make scripts_gdb - Error
  2023-04-12 10:28 Linux kernel debugging - make scripts_gdb - Error Little Tree
@ 2023-04-12 17:51 ` Luis Machado
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado @ 2023-04-12 17:51 UTC (permalink / raw)
  To: Little Tree, gdb

Hi,

On 4/12/23 11:28, Little Tree via Gdb wrote:
> I am remotely debugging an AArch64 Linux kernel running on QEMU using gdb.
> I wish to make use of the Python support while debugging (for using the
> commands like lx-dmesg).
> Referring to this link
> https://docs.kernel.org/dev-tools/gdb-kernel-debugging.html , I understand
> that for Linux kernel 5.1 and above, the scripting support is to be built
> using the command "make scripts_gdb" after the Linux kernel is built. I am
> getting many errors while building (mostly related to x86).
> 
> Do I have to set any arm specific environment variable before building? At
> present my build command is
> 
> $make scripts_gdb

In my experience I didn't have to make scripts_gdb. After enabling the CONFIG_GDB_SCRIPTS option in the kernel configuration, the helper python scripts were left in the kernel build tree.

When you load vmlinux, gdb will automatically attempt to load the helper python scripts if you have the proper auto-load permissions.

I did run into issues with a more recent kernel where it says the following when I try to load vmlinux into gdb:

Traceback (most recent call last):
   File "linux-arm64/vmlinux-gdb.py", line 25, in <module>
     import linux.utils
   File "linux-arm64/scripts/gdb/linux/utils.py", line 131, in <module>
     atomic_long_counter_offset = atomic_long_type.get_type()['counter'].bitpos
KeyError: 'counter'

I'm not sure if that's a bug in the helper scripts due to a recent commit or not. I recall these steps working out-of-the-box though.

> 
> 
> Thanks a lot,
>    Little


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-12 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-12 10:28 Linux kernel debugging - make scripts_gdb - Error Little Tree
2023-04-12 17:51 ` Luis Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).