lkml.org 
[lkml]   [2008]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [git pull] kgdb-light -v10
    Hi -

    On Tue, Feb 12, 2008 at 10:20:10AM -0800, Andrew Morton wrote:
    > [...] Bear in mind that one of the things you do with kgdb is to
    > modify kernel memory [...]

    Just for completeness, keep in mind that one can already
    do these sorts of things on a batch basis using systemtap:


    > int foo;
    > ...
    > if (foo == 1)
    > special_stuff();
    > ...
    >
    > to trigger a particular behaviour at a particular time. [...]

    If "foo" is a global within a particular compliation unit, any old
    function in that CU can be probed to set/get the global. (Setting
    incoming function parameters works too.)

    # cat delayed-set.stp
    # set a systemtap script variable based on a /proc control file
    probe procfs("activate").write { setit = $value }
    global setit
    # check the systemtap global in order to set the kernel global
    probe kernel.function("foo_checking_fn") {
    if (setit=="1") { setit = ""; $foo = 1 }
    }
    # stap -g -m ds delayed-set.stp &
    # echo 1 > /proc/systemtap/ds/activate


    > OT: another thing you can do with kgdb is error-path testing:
    > foo = kmalloc(...)
    > BP-> if (!foo)
    > recover();
    > put a breakpoint on the !foo test and set foo to zero by hand.

    # cat setit2.stp
    probe kernel.statement("*@dir/function.c:222") { /*if (desired)*/ $foo = 0 }
    # stap -g setit2.stp &


    - FChE


    \
     
     \ /
      Last update: 2008-02-12 20:41    [W:0.030 / U:3.156 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site