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

[email protected] Fri, 08 Nov 2013 09:51:54 -0500
Newsgroups org.kernel.vger.linux-newbie,org.kernelnewbies.kernelnewbies
Message-ID <[email protected]>
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....

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
signature.asc (application/pgp-signature, 865 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Exmh version 2.5 07/13/2001

iQIVAwUBUnz6igdmEQWDXROgAQLNyhAAru0oXA8izfzvxNEFNFWCx1av/fEU+wIN
3MYkNm1wjcOS8ugTYHHqIOyRKR5ay0gaMwaiVqKvyfziaJdG1K39s2xV+rml+PzS
mNwJcGUy+XtOKNR7HUlOIU9/e7MTt7c0JNDAnlhR/MpnTC8yxaQ+WJ8vI78JI6Ov
0HQTKmhHw2cJWD+YIjfJrhNP0RpUEOzf58VvZY2q9U/XmjIhlclVhEyWV3Jut5pC
/7fV255VoS+dXzwn4rsabKKOOECOKK1RJs5FBU9CEvf5Tb+KsysUE0B94a1yE/HO
sEcA6PxFisZiBGrrbMDF0q6DvKKqRLYOfgPy2szK3l7iH35OMCYtn4FfbSSmOqa9
huIk30uBy3O/wzZgKYcj9QAOUXie9FcuwQrPGiZH9+KgAoJPHS33gyrZ6psCxz2d
T9o4BahjGPYwxblWsZLhnzavXMDLYjJIyWfBNlII0WSD35N5nFyfg4PvdmDz3ipX
o+IleL7Pd2C5dBwaNnTQ++HdGnNXdBSnzWj91Lhwczq/wUSmZkTxlu9png+kxTOX
1ylBrmMmgjNAx197jVvpMUWGP9E2dLU1PvNfa1qxqo8svzvikx1KRByW2CfXNbCj
iIcPPyu/rsldxIeeWAWF17WJgttftWtmnKuMaW4RpsCci3hUurhj2IqxOacgODNA
w9WUXGdetNw=
=PLDq
-----END PGP SIGNATURE-----