[Bug 227093] powerpc64/pseries: Symbol table not relocated

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Mar 29 20:52:40 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=227093

            Bug ID: 227093
           Summary: powerpc64/pseries: Symbol table not relocated
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: breno.leitao at gmail.com

After the powerpc64 memory relocation code, the stack dumps on pseries does not
show the function names properly because the symbol table is not relocated.

I created a patch that fixes it on the wrong way, i.e, masking the symbol
address other than relocating the whole symbol table.

This is the workaround I am using at this moment, but I will work to relocated
the symbol table and send it for review.

diff --git a/sys/kern/subr_stack.c b/sys/kern/subr_stack.c
index 0254c7f3fd0..dd767858f8e 100644
--- a/sys/kern/subr_stack.c
+++ b/sys/kern/subr_stack.c
@@ -264,7 +264,9 @@ stack_symbol_ddb(vm_offset_t pc, const char **name, long
*offset)
        linker_symval_t symval;
        c_linker_sym_t sym;

-       if (linker_ddb_search_symbol((caddr_t)pc, &sym, offset) != 0)
+       caddr_t newpc =  (caddr_t) (pc & 0x0fffffffffffffff);
+
+       if (linker_ddb_search_symbol(newpc, &sym, offset) != 0)
                goto out;
        if (linker_ddb_symbol_values(sym, &symval) != 0)
                goto out;
diff --git a/sys/powerpc/powerpc/db_trace.c b/sys/powerpc/powerpc/db_trace.c
index a3ee988d438..68b886a68bc 100644
--- a/sys/powerpc/powerpc/db_trace.c
+++ b/sys/powerpc/powerpc/db_trace.c
@@ -284,7 +284,7 @@ db_backtrace(struct thread *td, db_addr_t fp, int count)
                }

                db_printf("at ");
-               db_printsym(lr, DB_STGY_PROC);
+               db_printsym(lr & 0x0fffffffffffffff, DB_STGY_PROC);
                if (full)
                        /* Print all the args stored in that stackframe. */
                        db_printf("(%zx, %zx, %zx, %zx, %zx, %zx, %zx, %zx)",

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list