Linux-kernel mailing list archive 2000-15,: Re: gdb can break on __init function ?

# Re: gdb can break on __init function ?

George Anzinger (george@pioneer.net)
Fri, 14 Apr 2000 00:31:28 -0700

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Jeremy Fitzhardinge: "More info on IDE lockup after APM restore"
- Previous message: Ulrich Drepper: "posix_fadvise"
- Maybe in reply to: Jun Sun: "gdb can break on __init function ?"

Keith Owens wrote:
>
> On Wed, 12 Apr 2000 14:03:43 -0700,
> Jun Sun <jsun@mvista.com> wrote:
> >I am using gdb/kdb to debug kernel through a serial line. It mostly
> >works. However I notice that I cannot break on any functions declared
> >as "__init". If I remove that declaration, everything is fine.
>
> __init code and data is collected in one place by the linker. After
> the kernel has finished initialization, the entire __init code and data
> is *freed* and reused as kmalloc space. Setting breakpoints in code
> that will be removed and reused for random data is a bad idea.

I must beg to differ. If the system never exits such code (as in a new
bring up) it is a very good idea. One should remember, however, to
remove
such breakpoints, or to not set them at all, once the kernel has (or is
about
to) *free(d)* the code, least one risk corruption of data with
breakpoints.
This of course, leads one to question if gdb removes and reinstalls
breakpoints
as it switches between waiting for the keyboard and waiting for the next
breakpoint to be hit. Usually debuggers do this to make the breakpoint
disapear to those who would list the code or otherwise examine memory.
Anyone know what gdb does?

George

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Jeremy Fitzhardinge: "More info on IDE lockup after APM restore"
- Previous message: Ulrich Drepper: "posix_fadvise"
- Maybe in reply to: Jun Sun: "gdb can break on __init function ?"