Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   crash: unwind with LKCD_KERNTYPES (http://www.linux-archive.org/crash-utility/232844-crash-unwind-lkcd_kerntypes.html)

Cliff Wickman 01-22-2009 10:23 PM

crash: unwind with LKCD_KERNTYPES
 
This patch enables stack unwind (on ia64) when using a kerntypes
file for a namelist.

When using a kerntypes file, we have just the address of variable unw
and the definition of an unw structure.

As you can see, I didn't change the indentation of the normal code.
Simple to do, but I didn't want to clutter this patch for a first pass.

I tested this against a live 2.6.16 (sles) kernel.
Diffed against crash-4.0-7.6

Signed-off-by: Cliff Wickman <cpw@sgi.com>

---
unwind.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Index: crash-4.0-7.6.ia64/unwind.c
================================================== =================
--- crash-4.0-7.6.ia64.orig/unwind.c
+++ crash-4.0-7.6.ia64/unwind.c
@@ -1395,10 +1395,43 @@ unwind_init_v2(void)
unwind_init_v3(void)
#endif
{
+ int len;
struct gnu_request request, *req;

req = &request;

+ if (LKCD_KERNTYPES()) {
+ if ((len = STRUCT_SIZE("unw")) == 0) {
+ error(WARNING,
+ "cannot determine unw.tables offset; no struct unw
");
+ machdep->flags |= UNW_OUT_OF_SYNC;
+ return;
+ }
+ machdep->machspec->unw_tables_offset =
+ MEMBER_OFFSET("unw", "tables");
+ if (MEMBER_EXISTS("unw", "r0"))
+ machdep->flags |= UNW_R0;
+ /*
+ * no verification of save_order, sw_off, preg_index as
+ * we're purely depending on the structure definition.
+ */
+ if (MEMBER_EXISTS("unw", "pt_regs_offsets")) {
+ machdep->machspec->unw_pt_regs_offsets =
+ MEMBER_OFFSET("unw", "pt_regs_offsets") -
+ machdep->machspec->unw_tables_offset;
+ machdep->machspec->unw_kernel_table_offset =
+ MEMBER_OFFSET("unw", "kernel_table") -
+ machdep->machspec->unw_tables_offset;
+ machdep->flags |= UNW_PTREGS;
+ }
+ if (!load_unw_table(CLEAR_SCRIPT_CACHE)) {
+ error(WARNING,
+ "unwind_init: cannot read kernel unw table
");
+ machdep->flags |= UNW_OUT_OF_SYNC;
+ }
+ machdep->machspec->unw = (void *)&unw;
+ /* fall to common structure size verifications */
+ } else {
if (get_symbol_type("unw", "tables", req) == TYPE_CODE_UNDEF) {
/*
* KLUDGE ALERT:
@@ -1449,6 +1482,7 @@ unwind_init_v3(void)

machdep->machspec->unw = (void *)&unw;
}
+ }

verify_common_struct("unw_frame_info", sizeof(struct unw_frame_info));
verify_common_struct("unw_table", sizeof(struct unw_table));

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Dave Anderson 01-23-2009 02:09 PM

crash: unwind with LKCD_KERNTYPES
 
----- "Cliff Wickman" <cpw@sgi.com> wrote:

> This patch enables stack unwind (on ia64) when using a kerntypes
> file for a namelist.
>
> When using a kerntypes file, we have just the address of variable unw
> and the definition of an unw structure.
>
> As you can see, I didn't change the indentation of the normal code.

Nicely segregated. But instead of leaving the indentation screwed up,
I just inserted a "goto verify" at the bottom of your if statement and
put the label at the proper location.

> Simple to do, but I didn't want to clutter this patch for a first
> pass.

With that in place, should I just take the patch for the next release,
or did you have something else you want to add?

Dave


>
> ---
> unwind.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> Index: crash-4.0-7.6.ia64/unwind.c
> ================================================== =================
> --- crash-4.0-7.6.ia64.orig/unwind.c
> +++ crash-4.0-7.6.ia64/unwind.c
> @@ -1395,10 +1395,43 @@ unwind_init_v2(void)
> unwind_init_v3(void)
> #endif
> {
> + int len;
> struct gnu_request request, *req;
>
> req = &request;
>
> + if (LKCD_KERNTYPES()) {
> + if ((len = STRUCT_SIZE("unw")) == 0) {
> + error(WARNING,
> + "cannot determine unw.tables offset; no struct unw
");
> + machdep->flags |= UNW_OUT_OF_SYNC;
> + return;
> + }
> + machdep->machspec->unw_tables_offset =
> + MEMBER_OFFSET("unw", "tables");
> + if (MEMBER_EXISTS("unw", "r0"))
> + machdep->flags |= UNW_R0;
> + /*
> + * no verification of save_order, sw_off, preg_index as
> + * we're purely depending on the structure definition.
> + */
> + if (MEMBER_EXISTS("unw", "pt_regs_offsets")) {
> + machdep->machspec->unw_pt_regs_offsets =
> + MEMBER_OFFSET("unw", "pt_regs_offsets") -
> + machdep->machspec->unw_tables_offset;
> + machdep->machspec->unw_kernel_table_offset =
> + MEMBER_OFFSET("unw", "kernel_table") -
> + machdep->machspec->unw_tables_offset;
> + machdep->flags |= UNW_PTREGS;
> + }
> + if (!load_unw_table(CLEAR_SCRIPT_CACHE)) {
> + error(WARNING,
> + "unwind_init: cannot read kernel unw table
");
> + machdep->flags |= UNW_OUT_OF_SYNC;
> + }
> + machdep->machspec->unw = (void *)&unw;
> + /* fall to common structure size verifications */
> + } else {
> if (get_symbol_type("unw", "tables", req) == TYPE_CODE_UNDEF)
> {
> /*
> * KLUDGE ALERT:
> @@ -1449,6 +1482,7 @@ unwind_init_v3(void)
>
> machdep->machspec->unw = (void *)&unw;
> }
> + }
>
> verify_common_struct("unw_frame_info", sizeof(struct
> unw_frame_info));
> verify_common_struct("unw_table", sizeof(struct unw_table));

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Dave Anderson 01-23-2009 02:35 PM

crash: unwind with LKCD_KERNTYPES
 
----- Forwarded Message -----
From: "Cliff Wickman" <cpw@sgi.com>
To: "Dave Anderson" <anderson@redhat.com>
Sent: Friday, January 23, 2009 10:30:49 AM GMT -05:00 US/Canada Eastern
Subject: Re: [PATCH] crash: unwind with LKCD_KERNTYPES

Hi Dave,

On Fri, Jan 23, 2009 at 10:09:30AM -0500, Dave Anderson wrote:
>
> ----- "Cliff Wickman" <cpw@sgi.com> wrote:
>
> > This patch enables stack unwind (on ia64) when using a kerntypes
> > file for a namelist.
> >
> > When using a kerntypes file, we have just the address of variable unw
> > and the definition of an unw structure.
> >
> > As you can see, I didn't change the indentation of the normal code.
>
> Nicely segregated. But instead of leaving the indentation screwed up,
> I just inserted a "goto verify" at the bottom of your if statement and
> put the label at the proper location.
>
> > Simple to do, but I didn't want to clutter this patch for a first
> > pass.
>
> With that in place, should I just take the patch for the next release,
> or did you have something else you want to add?

Sounds good. I have nothing more to add. Thanks.

-Cliff
>
> Dave
>
>
> >
> > ---
> > unwind.c | 34 ++++++++++++++++++++++++++++++++++
> > 1 file changed, 34 insertions(+)
> >
> > Index: crash-4.0-7.6.ia64/unwind.c
> > ================================================== =================
> > --- crash-4.0-7.6.ia64.orig/unwind.c
> > +++ crash-4.0-7.6.ia64/unwind.c
> > @@ -1395,10 +1395,43 @@ unwind_init_v2(void)
> > unwind_init_v3(void)
> > #endif
> > {
> > + int len;
> > struct gnu_request request, *req;
> >
> > req = &request;
> >
> > + if (LKCD_KERNTYPES()) {
> > + if ((len = STRUCT_SIZE("unw")) == 0) {
> > + error(WARNING,
> > + "cannot determine unw.tables offset; no struct unw
");
> > + machdep->flags |= UNW_OUT_OF_SYNC;
> > + return;
> > + }
> > + machdep->machspec->unw_tables_offset =
> > + MEMBER_OFFSET("unw", "tables");
> > + if (MEMBER_EXISTS("unw", "r0"))
> > + machdep->flags |= UNW_R0;
> > + /*
> > + * no verification of save_order, sw_off, preg_index as
> > + * we're purely depending on the structure definition.
> > + */
> > + if (MEMBER_EXISTS("unw", "pt_regs_offsets")) {
> > + machdep->machspec->unw_pt_regs_offsets =
> > + MEMBER_OFFSET("unw", "pt_regs_offsets") -
> > + machdep->machspec->unw_tables_offset;
> > + machdep->machspec->unw_kernel_table_offset =
> > + MEMBER_OFFSET("unw", "kernel_table") -
> > + machdep->machspec->unw_tables_offset;
> > + machdep->flags |= UNW_PTREGS;
> > + }
> > + if (!load_unw_table(CLEAR_SCRIPT_CACHE)) {
> > + error(WARNING,
> > + "unwind_init: cannot read kernel unw table
");
> > + machdep->flags |= UNW_OUT_OF_SYNC;
> > + }
> > + machdep->machspec->unw = (void *)&unw;
> > + /* fall to common structure size verifications */
> > + } else {
> > if (get_symbol_type("unw", "tables", req) == TYPE_CODE_UNDEF)
> > {
> > /*
> > * KLUDGE ALERT:
> > @@ -1449,6 +1482,7 @@ unwind_init_v3(void)
> >
> > machdep->machspec->unw = (void *)&unw;
> > }
> > + }
> >
> > verify_common_struct("unw_frame_info", sizeof(struct
> > unw_frame_info));
> > verify_common_struct("unw_table", sizeof(struct unw_table));

--
Cliff Wickman
Silicon Graphics, Inc.
cpw@sgi.com
(651) 683-3824

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility


All times are GMT. The time now is 07:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.