How to find out which part of code is changing a particular data structure.

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Fri Nov 8 09:51:54 EST 2013


On Thu, 07 Nov 2013 23:23:18 -0800, kiran kumar said:
> Can you define that location as read only(i.e constant)?. This is only for
> debug prupose, later you can remove.

Note that this requires 2 things:

1) A kernel built with CONFIG_DEBUG_RODATA=y

2) The structure needs to have a compile-time initializer:

struct foo barbaz = { 5, 3, "quuz"};

Otherwise, your kernel will throw an oops when it tries to initialize
the structure at runtime (which is almost certainly *not* the time that
is causing the actual problem).

Simply declaring it as 'const struct' may or may not help - this will catch
at compile time lots of mistakes, but isn't guaranteed to stop all cases of
buggy uses of miscast pointers, etc....
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131108/911e8537/attachment.bin 


More information about the Kernelnewbies mailing list