[Crash-utility] How to print structs in user space?

Dave Anderson anderson at redhat.com
Fri Mar 7 19:10:18 UTC 2008


Dheeraj Sangamkar wrote:
> Thanks Dave,
> ioctl related data structures are common.
> I did not find the -u switch in the help for struct command in crash.
> Hopefully, my version of crash supports it.
> 

It's been there since 4.0-3.19:

   http://people.redhat.com/anderson/crash.changelog.html#4_0_3_19

 > Hopefully, my version of crash supports it.

If it doesn't, upgrade man, upgrade!!!

Dave



> Dheeraj
> 
> On Fri, Mar 7, 2008 at 8:32 PM, Dave Anderson <anderson at redhat.com 
> <mailto:anderson at redhat.com>> wrote:
> 
> 
>     Dheeraj Sangamkar wrote:
>      > Hi,
>      > When I debug ioctls, I get parameters which are pointers to
>     structures
>      > in user space.
>      > I am unable to use the struct command to print these structures.
>      >
>      > Currently I am using "rd -u" to read the content of user memory and
>      > decode it based on the structure information I have.
>      >
>      > Am I missing something? Is there an easier way to do this?
> 
>     As an addendum to the steps I described in my last post, it's possible
>     that in your particular case that the ioctl-related data structures in
>     user space are also "known" by the kernel, i.e. structures that are
>     common to both user-space and kernel-space.  If that's true,
>     then you don't need the "add-symbol-file" step -- just make
>     sure that you are in the crash context of the process that
>     owns the user-space instance, determine the user-space address
>     of the structure, and simply use the "struct -u" option.
> 
>     Dave
> 
> 
>     --
>     Crash-utility mailing list
>     Crash-utility at redhat.com <mailto:Crash-utility at redhat.com>
>     https://www.redhat.com/mailman/listinfo/crash-utility
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility




More information about the Crash-utility mailing list