All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/gdb: Handle split debug
@ 2019-07-30 23:40 Douglas Anderson
  2019-07-31 14:17 ` Stephen Boyd
  2019-07-31 14:24 ` Jan Kiszka
  0 siblings, 2 replies; 5+ messages in thread
From: Douglas Anderson @ 2019-07-30 23:40 UTC (permalink / raw)
  To: Jan Kiszka, Kieran Bingham, Andrew Morton
  Cc: kgdb-bugreport, Jason Wessel, Daniel Thompson, Stephen Boyd,
	Douglas Anderson, linux-kernel

Some systems (like Chrome OS) may use "split debug" for kernel
modules.  That means that the debug symbols are in a different file
than the main elf file.  Let's handle that by also searching for debug
symbols that end in ".ko.debug".

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 scripts/gdb/linux/symbols.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
index 2f5b95f09fa0..34e40e96dee2 100644
--- a/scripts/gdb/linux/symbols.py
+++ b/scripts/gdb/linux/symbols.py
@@ -77,12 +77,12 @@ lx-symbols command."""
             gdb.write("scanning for modules in {0}\n".format(path))
             for root, dirs, files in os.walk(path):
                 for name in files:
-                    if name.endswith(".ko"):
+                    if name.endswith(".ko") or name.endswith(".ko.debug"):
                         self.module_files.append(root + "/" + name)
         self.module_files_updated = True
 
     def _get_module_file(self, module_name):
-        module_pattern = ".*/{0}\.ko$".format(
+        module_pattern = ".*/{0}\.ko(?:.debug)?$".format(
             module_name.replace("_", r"[_\-]"))
         for name in self.module_files:
             if re.match(module_pattern, name) and os.path.exists(name):
-- 
2.22.0.709.g102302147b-goog


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

* Re: [PATCH] scripts/gdb: Handle split debug
  2019-07-30 23:40 [PATCH] scripts/gdb: Handle split debug Douglas Anderson
@ 2019-07-31 14:17 ` Stephen Boyd
  2019-07-31 14:24 ` Jan Kiszka
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2019-07-31 14:17 UTC (permalink / raw)
  To: Andrew Morton, Douglas Anderson, Jan Kiszka, Kieran Bingham
  Cc: kgdb-bugreport, Jason Wessel, Daniel Thompson, Douglas Anderson,
	linux-kernel

Quoting Douglas Anderson (2019-07-30 16:40:52)
> Some systems (like Chrome OS) may use "split debug" for kernel
> modules.  That means that the debug symbols are in a different file
> than the main elf file.  Let's handle that by also searching for debug
> symbols that end in ".ko.debug".
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>


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

* Re: [PATCH] scripts/gdb: Handle split debug
  2019-07-30 23:40 [PATCH] scripts/gdb: Handle split debug Douglas Anderson
  2019-07-31 14:17 ` Stephen Boyd
@ 2019-07-31 14:24 ` Jan Kiszka
  2019-07-31 15:44   ` Doug Anderson
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2019-07-31 14:24 UTC (permalink / raw)
  To: Douglas Anderson, Kieran Bingham, Andrew Morton
  Cc: kgdb-bugreport, Jason Wessel, Daniel Thompson, Stephen Boyd,
	linux-kernel

On 31.07.19 01:40, Douglas Anderson wrote:
> Some systems (like Chrome OS) may use "split debug" for kernel
> modules.  That means that the debug symbols are in a different file
> than the main elf file.  Let's handle that by also searching for debug
> symbols that end in ".ko.debug".

Is this split-up depending on additional kernel patches, is this already
possible with mainline, or is this purely a packaging topic? Wondering because
of testability in case it's downstream-only.

Jan

> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
>  scripts/gdb/linux/symbols.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
> index 2f5b95f09fa0..34e40e96dee2 100644
> --- a/scripts/gdb/linux/symbols.py
> +++ b/scripts/gdb/linux/symbols.py
> @@ -77,12 +77,12 @@ lx-symbols command."""
>              gdb.write("scanning for modules in {0}\n".format(path))
>              for root, dirs, files in os.walk(path):
>                  for name in files:
> -                    if name.endswith(".ko"):
> +                    if name.endswith(".ko") or name.endswith(".ko.debug"):
>                          self.module_files.append(root + "/" + name)
>          self.module_files_updated = True
>  
>      def _get_module_file(self, module_name):
> -        module_pattern = ".*/{0}\.ko$".format(
> +        module_pattern = ".*/{0}\.ko(?:.debug)?$".format(
>              module_name.replace("_", r"[_\-]"))
>          for name in self.module_files:
>              if re.match(module_pattern, name) and os.path.exists(name):
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

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

* Re: [PATCH] scripts/gdb: Handle split debug
  2019-07-31 14:24 ` Jan Kiszka
@ 2019-07-31 15:44   ` Doug Anderson
  2019-07-31 16:23     ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Anderson @ 2019-07-31 15:44 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: Kieran Bingham, Andrew Morton, kgdb-bugreport, Jason Wessel,
	Daniel Thompson, Stephen Boyd, LKML

Hi,

On Wed, Jul 31, 2019 at 7:24 AM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 31.07.19 01:40, Douglas Anderson wrote:
> > Some systems (like Chrome OS) may use "split debug" for kernel
> > modules.  That means that the debug symbols are in a different file
> > than the main elf file.  Let's handle that by also searching for debug
> > symbols that end in ".ko.debug".
>
> Is this split-up depending on additional kernel patches, is this already
> possible with mainline, or is this purely a packaging topic? Wondering because
> of testability in case it's downstream-only.

It is a packaging topic.  You can take a normal elf file and split the
debug out of it using objcopy.  Try "man objcopy" and then take a look
at the "--only-keep-debug" option.  It'll give you a whole recipe for
doing splitdebug.  The suffix used for the debug symbols is arbitrary.
If people have other another suffix besides ".ko.debug" then we could
presumably support that too...

For portage (which is the packaging system used by Chrome OS) split
debug is supported by default (and the suffix is .ko.debug).  ...and
so in Chrome OS we always get the installed elf files stripped and
then the symbols stashed away.

At the moment we don't actually use the normal portage magic to do
this for the kernel though since it affects our ability to get good
stack dumps in the kernel.  We instead pass a script as "strip" [1].


[1] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/master/eclass/cros-kernel/strip_splitdebug


-Doug

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

* Re: [PATCH] scripts/gdb: Handle split debug
  2019-07-31 15:44   ` Doug Anderson
@ 2019-07-31 16:23     ` Jan Kiszka
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2019-07-31 16:23 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Kieran Bingham, Andrew Morton, kgdb-bugreport, Jason Wessel,
	Daniel Thompson, Stephen Boyd, LKML

On 31.07.19 17:44, Doug Anderson wrote:
> Hi,
> 
> On Wed, Jul 31, 2019 at 7:24 AM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>
>> On 31.07.19 01:40, Douglas Anderson wrote:
>>> Some systems (like Chrome OS) may use "split debug" for kernel
>>> modules.  That means that the debug symbols are in a different file
>>> than the main elf file.  Let's handle that by also searching for debug
>>> symbols that end in ".ko.debug".
>>
>> Is this split-up depending on additional kernel patches, is this already
>> possible with mainline, or is this purely a packaging topic? Wondering because
>> of testability in case it's downstream-only.
> 
> It is a packaging topic.  You can take a normal elf file and split the
> debug out of it using objcopy.  Try "man objcopy" and then take a look
> at the "--only-keep-debug" option.  It'll give you a whole recipe for
> doing splitdebug.  The suffix used for the debug symbols is arbitrary.
> If people have other another suffix besides ".ko.debug" then we could
> presumably support that too...
> 
> For portage (which is the packaging system used by Chrome OS) split
> debug is supported by default (and the suffix is .ko.debug).  ...and
> so in Chrome OS we always get the installed elf files stripped and
> then the symbols stashed away.
> 
> At the moment we don't actually use the normal portage magic to do
> this for the kernel though since it affects our ability to get good
> stack dumps in the kernel.  We instead pass a script as "strip" [1].
> 
> 
> [1] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/master/eclass/cros-kernel/strip_splitdebug
> 
> 
> -Doug
> 

Thanks, makes perfect sense to me. You may add my

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

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

end of thread, other threads:[~2019-07-31 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 23:40 [PATCH] scripts/gdb: Handle split debug Douglas Anderson
2019-07-31 14:17 ` Stephen Boyd
2019-07-31 14:24 ` Jan Kiszka
2019-07-31 15:44   ` Doug Anderson
2019-07-31 16:23     ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.