public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: kiran kumar <akirank@yahoo.com>
Cc: Rajat Jain <rajatjain@juniper.net>,
	"linux-newbie@vger.kernel.org" <linux-newbie@vger.kernel.org>,
	"kernelnewbies@kernelnewbies.org"
	<kernelnewbies@kernelnewbies.org>
Subject: Re: How to find out which part of code is changing a particular data structure.
Date: Fri, 08 Nov 2013 09:51:54 -0500	[thread overview]
Message-ID: <52596.1383922314@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Thu, 07 Nov 2013 23:23:18 -0800." <1383895398.45469.YahooMailNeo@web142703.mail.bf1.yahoo.com>


[-- Attachment #1.1: Type: text/plain, Size: 717 bytes --]

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....

[-- Attachment #1.2: Type: application/pgp-signature, Size: 865 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2013-11-08 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08  0:46 How to find out which part of code is changing a particular data structure Rajat Jain
2013-11-08  3:31 ` Chetan Nanda
2013-11-08  7:23   ` kiran kumar
2013-11-08 14:51     ` Valdis.Kletnieks [this message]
2013-11-08 21:03 ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52596.1383922314@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=akirank@yahoo.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-newbie@vger.kernel.org \
    --cc=rajatjain@juniper.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox