public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
* How to find out which part of code is changing a particular data structure.
@ 2013-11-08  0:46 Rajat Jain
  2013-11-08  3:31 ` Chetan Nanda
  2013-11-08 21:03 ` Frank Ch. Eigler
  0 siblings, 2 replies; 5+ messages in thread
From: Rajat Jain @ 2013-11-08  0:46 UTC (permalink / raw)
  To: kernelnewbies@kernelnewbies.org, linux-newbie@vger.kernel.org

Hi folks,

I have a memory location (One of the fields in a kernel data structure) and I want to track down the code that changes the value of that particular location. Some thing like a "watchpoint".

And this is early while I am still booting up. Can some one tell me if it is possible to do so?

Thanks,

Rajat

 

--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to find out which part of code is changing a particular data structure.
  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 21:03 ` Frank Ch. Eigler
  1 sibling, 1 reply; 5+ messages in thread
From: Chetan Nanda @ 2013-11-08  3:31 UTC (permalink / raw)
  To: Rajat Jain; +Cc: linux-newbie@vger.kernel.org, kernelnewbies@kernelnewbies.org


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

You may attach debugger (like Lauterbach) and use its data breakpoint
functionality.

Thanks,
Chetan Nanda


On Fri, Nov 8, 2013 at 6:16 AM, Rajat Jain <rajatjain@juniper.net> wrote:

> Hi folks,
>
> I have a memory location (One of the fields in a kernel data structure)
> and I want to track down the code that changes the value of that particular
> location. Some thing like a "watchpoint".
>
> And this is early while I am still booting up. Can some one tell me if it
> is possible to do so?
>
> Thanks,
>
> Rajat
>
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

[-- Attachment #1.2: Type: text/html, Size: 1248 bytes --]

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to find out which part of code is changing a particular data structure.
  2013-11-08  3:31 ` Chetan Nanda
@ 2013-11-08  7:23   ` kiran kumar
  2013-11-08 14:51     ` Valdis.Kletnieks
  0 siblings, 1 reply; 5+ messages in thread
From: kiran kumar @ 2013-11-08  7:23 UTC (permalink / raw)
  To: Rajat Jain; +Cc: linux-newbie@vger.kernel.org, kernelnewbies@kernelnewbies.org


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

Hi Rjat,
Can you define that location as read only(i.e constant)?. This is only for debug prupose, later you can remove. 
I am expecting kernel panic with this change. 
Regards,
Kiran



On Friday, 8 November 2013, 9:03, Chetan Nanda <chetannanda@gmail.com> wrote:
  
You may attach debugger (like Lauterbach) and use its data breakpoint functionality. 

Thanks,
Chetan Nanda




On Fri, Nov 8, 2013 at 6:16 AM, Rajat Jain <rajatjain@juniper.net> wrote:

Hi folks,
>
>I have a memory location (One of the fields in a kernel data structure) and I want to track down the code that changes the value of that particular location. Some thing like a "watchpoint".
>
>And this is early while I am still booting up. Can some one tell me if it is possible to do so?
>
>Thanks,
>
>Rajat
>
>
>
>
>_______________________________________________
>Kernelnewbies mailing list
>Kernelnewbies@kernelnewbies.org
>http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>


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

[-- Attachment #1.2: Type: text/html, Size: 3525 bytes --]

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to find out which part of code is changing a particular data structure.
  2013-11-08  7:23   ` kiran kumar
@ 2013-11-08 14:51     ` Valdis.Kletnieks
  0 siblings, 0 replies; 5+ messages in thread
From: Valdis.Kletnieks @ 2013-11-08 14:51 UTC (permalink / raw)
  To: kiran kumar
  Cc: Rajat Jain, linux-newbie@vger.kernel.org,
	kernelnewbies@kernelnewbies.org


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to find out which part of code is changing a particular data structure.
  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 21:03 ` Frank Ch. Eigler
  1 sibling, 0 replies; 5+ messages in thread
From: Frank Ch. Eigler @ 2013-11-08 21:03 UTC (permalink / raw)
  To: Rajat Jain; +Cc: kernelnewbies@kernelnewbies.org, linux-newbie@vger.kernel.org

Rajat Jain <rajatjain@juniper.net> writes:

> [...]  I have a memory location (One of the fields in a kernel data
> structure) and I want to track down the code that changes the value
> of that particular location. Some thing like a "watchpoint".

See the register_wide_hw_breakpoint API.  You could write a small
module that runs early, and gets callbacks when a given address is
modified.


> And this is early while I am still booting up. Can some one tell me
> if it is possible to do so?

(Were it not for the 'while still booting up' part, I'd suggest trying
systemtap's 

        probe kernel.data("SYMBOL").write { }
 or     probe kernel.data(0xDEADBEEF).write { }

probes, but we haven't worked through initramfs'ifying the widget.)


- FChE
--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-08 21:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-11-08 21:03 ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox