[Skiboot] [PATCH] mambo: Match whole string when looking up symbols with linsym/skisym

Oliver O'Halloran oohall at gmail.com
Wed May 31 13:32:57 AEST 2017


On Wed, May 31, 2017 at 1:04 PM, Michael Ellerman <mpe at ellerman.id.au> wrote:
> linsym/skisym use a regex to match the symbol name, and accepts a
> partial match against the entry in the symbol map, which can lead to
> somewhat confusing results, eg:
>
>   systemsim % linsym early_setup
>   0xc000000000027890
>   systemsim % linsym early_setup$
>   0xc000000000aa8054
>   systemsim % linsym early_setup_secondary
>   0xc000000000027890
>
> I don't think that's the behaviour we want, so append a $ to the name so
> that the symbol has to match against the whole entry, eg:
>
>   systemsim % linsym early_setup
>   0xc000000000aa8054
>
> Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>

Tested-by: Oliver O'Halloran <oohall at gmail.com>

Although, come to think of it we'll have a similar issue with dot
symbols since the symbol name is baked into the regex and dot matches
anything.

> ---
>  external/mambo/mambo_utils.tcl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl
> index 837ae9b06abe..1e3dea0e8af1 100644
> --- a/external/mambo/mambo_utils.tcl
> +++ b/external/mambo/mambo_utils.tcl
> @@ -336,7 +336,7 @@ proc linsym { name } {
>
>      # create a regexp that matches the symbol name
>      set base {([[:xdigit:]]*) (.)}
> -    set exp [concat $base " $name"]
> +    set exp [concat $base " $name\$"]
>      set ret ""
>
>      foreach {line addr type} [regexp -line -inline $exp $linux_symbol_map] {
> @@ -352,7 +352,7 @@ proc skisym { name } {
>      global mconf
>
>      set base {([[:xdigit:]]*) (.)}
> -    set exp [concat $base " $name"]
> +    set exp [concat $base " $name\$"]
>      set ret ""
>
>      foreach {line addr type} [regexp -line -inline $exp $skiboot_symbol_map] {
> --
> 2.7.4
>


More information about the Skiboot mailing list