module debugging
Subsystems (7)
PATCH 1/1 module debugging
This patch is against current git. Also I previously tried to subscribe to this mailing list by sending a subscribe mail to [email protected] with in header and body "subscribe kernel-janitors", but it appears to have failed. Did I do it incorrectly?
---
Create option MODULES_DEBUG for loadable module debugging
Signed-off-by Roel Kluin <[email protected]>
---
arch/alpha/kernel/module.c +4 -6
@@ -20,14 +20,12 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> #include <linux/slab.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size)
@@ -168,7 +166,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,void *base, *location;unsigned long got, gp; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info); base = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr;
arch/cris/kernel/module.c +4 -6
@@ -20,13 +20,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP (fmt , ...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -72,7 +70,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,unsigned int i;Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; -DEBUGP ("Applying add relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying add relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rela); i++) {
arch/frv/kernel/module.c +3 -5
@@ -14,13 +14,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
arch/h8300/kernel/module.c +4 -6
@@ -3,13 +3,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -56,7 +54,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,unsigned int i;Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rela); i++) {/* This is where to make the change */
arch/ia64/kernel/module.c +13 -17
@@ -26,7 +26,6 @@*/ -#include <linux/kernel.h> #include <linux/sched.h> #include <linux/elf.h> #include <linux/moduleloader.h>
@@ -36,14 +35,11 @@#include <asm/patch.h> #include <asm/unaligned.h> -#define ARCH_MODULE_DEBUG 0 - -#if ARCH_MODULE_DEBUG -# define DEBUGP printk -# define inline -#else -# define DEBUGP(fmt , a...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> +#ifdef CONFIG_ITANIUM # define USE_BRL 0
@@ -492,7 +488,7 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings, mod->arch.opd->sh_flags =SHF_ALLOC ; mod->arch.opd->sh_addralign =8 ; mod->arch.opd->sh_size = fdescs *sizeof (struct fdesc ); -DEBUGP ("%s: core.plt=%lx, init.plt=%lx, got=%lx, fdesc=%lx\n" , +printk (KERN_DEBUG "%s: core.plt=%lx, init.plt=%lx, got=%lx, fdesc=%lx\n" , __FUNCTION__, mod->arch.core_plt->sh_size, mod->arch.init_plt->sh_size, mod->arch.got->sh_size, mod->arch.opd->sh_size);return 0 ;
@@ -737,7 +733,7 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,case R_IA64_LDXMOV :if (gp_addressable (mod, val)) {/* turn "ld8" into "mov": */ -DEBUGP ("%s: patching ld8 at %p to mov\n" , __FUNCTION__, location); +printk (KERN_DEBUG "%s: patching ld8 at %p to mov\n" , __FUNCTION__, location);ia64_patch ((u64 ) location,0x1fff80fe000UL ,0x10000000000UL ); }return 0 ;
@@ -771,7 +767,7 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,if (!ok)return -ENOEXEC ; -DEBUGP ("%s: [%p]<-%016lx = %s(%lx)\n" , __FUNCTION__, location, val, +printk (KERN_DEBUG "%s: [%p]<-%016lx = %s(%lx)\n" , __FUNCTION__, location, val, reloc_name[r_type] ? reloc_name[r_type] :"?" , sym->st_value + addend);switch (format) {
@@ -807,7 +803,7 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symindElf64_Shdr *target_sec;int ret; -DEBUGP ("%s: applying section %u (%u relocs) to %u\n" , __FUNCTION__, +printk (KERN_DEBUG "%s: applying section %u (%u relocs) to %u\n" , __FUNCTION__, relsec, n, sechdrs[relsec].sh_info); target_sec = sechdrs + sechdrs[relsec].sh_info;
@@ -835,7 +831,7 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind gp = mod->core_size /2 ; gp = (uint64_t ) mod->module_core + ((gp +7 ) &-8 ); mod->arch.gp = gp; -DEBUGP ("%s: placing gp at 0x%lx\n" , __FUNCTION__, gp); +printk (KERN_DEBUG "%s: placing gp at 0x%lx\n" , __FUNCTION__, gp); }for (i =0 ; i < n; i++) {
@@ -903,7 +899,7 @@ register_unwind_table (struct module *mod) init = start + num_core; } -DEBUGP ("%s: name=%s, gp=%lx, num_init=%lu, num_core=%lu\n" , __FUNCTION__, +printk (KERN_DEBUG "%s: name=%s, gp=%lx, num_init=%lu, num_core=%lu\n" , __FUNCTION__, mod->name, mod->arch.gp, num_init, num_core);/*
@@ -912,13 +908,13 @@ register_unwind_table (struct module *mod)if (num_core >0 ) { mod->arch.core_unw_table =unw_add_unwind_table (mod->name,0 , mod->arch.gp, core, core + num_core); -DEBUGP ("%s: core: handle=%p [%p-%p)\n" , __FUNCTION__, +printk (KERN_DEBUG "%s: core: handle=%p [%p-%p)\n" , __FUNCTION__, mod->arch.core_unw_table, core, core + num_core); }if (num_init >0 ) { mod->arch.init_unw_table =unw_add_unwind_table (mod->name,0 , mod->arch.gp, init, init + num_init); -DEBUGP ("%s: init: handle=%p [%p-%p)\n" , __FUNCTION__, +printk (KERN_DEBUG "%s: init: handle=%p [%p-%p)\n" , __FUNCTION__, mod->arch.init_unw_table, init, init + num_init); } }
@@ -926,7 +922,7 @@ register_unwind_table (struct module *mod)int module_finalize (const Elf_Ehdr *hdr,const Elf_Shdr *sechdrs,struct module *mod) { -DEBUGP ("%s: init: entry=%p\n" , __FUNCTION__, mod->init); +printk (KERN_DEBUG "%s: init: entry=%p\n" , __FUNCTION__, mod->init);if (mod->arch.unwind)register_unwind_table (mod);return 0 ;
arch/m32r/kernel/module.c +4 -6
@@ -20,13 +20,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef SMP_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -114,7 +112,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,int svalue;int align; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
arch/m68k/kernel/module.c +5 -7
@@ -9,13 +9,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> #ifdef CONFIG_MODULES
@@ -55,7 +53,7 @@ int apply_relocate(Elf32_Shdr *sechdrs,Elf32_Sym *sym;uint32_t *location; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -95,7 +93,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,Elf32_Sym *sym;uint32_t *location; -DEBUGP ("Applying relocate_add section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate_add section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
arch/m68knommu/kernel/module.c +5 -7
@@ -3,13 +3,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -47,7 +45,7 @@ int apply_relocate(Elf32_Shdr *sechdrs,Elf32_Sym *sym;uint32_t *location; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -87,7 +85,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,Elf32_Sym *sym;uint32_t *location; -DEBUGP ("Applying relocate_add section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate_add section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
arch/parisc/kernel/module.c +18 -20
@@ -45,16 +45,14 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> #include <linux/bug.h> #include <asm/unwind.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef PCI_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> #define CHECK_RELOC (val, bits) \ if ( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \
@@ -339,7 +337,7 @@ static Elf64_Word get_got(struct module *me, unsigned long value, long addend) got[i].addr = value; out: -DEBUGP ("GOT ENTRY %d[%x] val %lx\n" , i, i*sizeof (struct got_entry ), +printk (KERN_DEBUG "GOT ENTRY %d[%x] val %lx\n" , i, i*sizeof (struct got_entry ), value);return i *sizeof (struct got_entry ); }
@@ -490,7 +488,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,//unsigned long dp = (unsigned long)$global$; registerunsigned long dp asm ("r27" ); -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -512,7 +510,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,#if 0 #define r (t) ELF32_R_TYPE(rel[i].r_info)=t ? #t : -DEBUGP ("Symbol %s loc 0x%x val 0x%x addend 0x%x: %s\n" , +printk (KERN_DEBUG "Symbol %s loc 0x%x val 0x%x addend 0x%x: %s\n" , strtab + sym->st_name, (uint32_t )loc, val, addend, r(R_PARISC_PLABEL32)
@@ -575,7 +573,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,case R_PARISC_PCREL22F :/* 22-bit PC relative address; only defined for pa20 */ val =get_stub (me, val, addend,ELF_STUB_GOT ,in_init (me, loc)); -DEBUGP ("STUB FOR %s loc %lx+%lx at %lx\n" , +printk (KERN_DEBUG "STUB FOR %s loc %lx+%lx at %lx\n" , strtab + sym->st_name, (unsigned long )loc, addend, val) val = (val - dot - 8)/4;
@@ -609,7 +607,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,Elf64_Sxword addend;Elf64_Addr dot; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -649,7 +647,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,case R_PARISC_LTOFF21L :/* LT-relative; left 21 bits */ val =get_got (me, val, addend); -DEBUGP ("LTOFF21L Symbol %s loc %p val %lx\n" , +printk (KERN_DEBUG "LTOFF21L Symbol %s loc %p val %lx\n" , strtab + sym->st_name, loc, val); val =lrsel (val,0 );
@@ -660,14 +658,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs,/* LT-relative; right 14 bits */ val =get_got (me, val, addend); val =rrsel (val,0 ); -DEBUGP ("LTOFF14R Symbol %s loc %p val %lx\n" , +printk (KERN_DEBUG "LTOFF14R Symbol %s loc %p val %lx\n" , strtab + sym->st_name, loc, val); *loc =mask (*loc,14 ) |reassemble_14 (val);break ;case R_PARISC_PCREL22F :/* PC-relative; 22 bits */ -DEBUGP ("PCREL22F Symbol %s loc %p val %lx\n" , +printk (KERN_DEBUG "PCREL22F Symbol %s loc %p val %lx\n" , strtab + sym->st_name, loc, val);/* can we reach it locally? */
@@ -690,7 +688,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs, val =get_stub (me, val, addend,ELF_STUB_GOT ,in_init (me, loc)); } -DEBUGP ("STUB FOR %s loc %lx, val %lx+%lx at %lx\n" , +printk (KERN_DEBUG "STUB FOR %s loc %lx, val %lx+%lx at %lx\n" , strtab + sym->st_name, loc, sym->st_value, addend, val);/* FIXME: local symbols work as long as the
@@ -723,14 +721,14 @@ int apply_relocate_add(Elf_Shdr *sechdrs,/* 64-bit function address */ if (in_local (me, (void *)(val + addend))) { *loc64 =get_fdesc (me, val+addend); -DEBUGP ("FDESC for %s at %p points to %lx\n" , +printk (KERN_DEBUG "FDESC for %s at %p points to %lx\n" , strtab + sym->st_name, *loc64, ((Elf_Fdesc *)*loc64)->addr); }else {/* if the symbol is not local to this * module then val+addend is a pointer * to the function descriptor */ -DEBUGP ("Non local FPTR64 Symbol %s loc %p val %lx\n" , +printk (KERN_DEBUG "Non local FPTR64 Symbol %s loc %p val %lx\n" , strtab + sym->st_name, loc, val); *loc64 = val + addend;
@@ -761,7 +759,7 @@ register_unwind_table(struct module *me, end = table + sechdrs[me->arch.unwind_section].sh_size; gp = (Elf_Addr )me->module_core + me->arch.got_offset; -DEBUGP ("register_unwind_table(), sect = %d at 0x%p - 0x%p (gp=0x%lx)\n" , +printk (KERN_DEBUG "register_unwind_table(), sect = %d at 0x%p - 0x%p (gp=0x%lx)\n" , me->arch.unwind_section, table, end, gp); me->arch.unwind =unwind_table_add (me->name,0 , gp, table, end); }
@@ -819,7 +817,7 @@ int module_finalize(const Elf_Ehdr *hdr, } } -DEBUGP ("module %s: strtab %p, symhdr %p\n" , +printk (KERN_DEBUG "module %s: strtab %p, symhdr %p\n" , me->name, strtab, symhdr);if (me->arch.got_count >MAX_GOTS ) {
@@ -835,7 +833,7 @@ int module_finalize(const Elf_Ehdr *hdr, oldptr = (void *)symhdr->sh_addr; newptr = oldptr +1 ;/* we start counting at 1 */ nsyms = symhdr->sh_size /sizeof (Elf_Sym); -DEBUGP ("OLD num_symtab %lu\n" , nsyms); +printk (KERN_DEBUG "OLD num_symtab %lu\n" , nsyms);for (i =1 ; i < nsyms; i++) { oldptr++;/* note, count starts at 1 so preincrement */
@@ -850,7 +848,7 @@ int module_finalize(const Elf_Ehdr *hdr, } nsyms = newptr - (Elf_Sym *)symhdr->sh_addr; -DEBUGP ("NEW num_symtab %lu\n" , nsyms); +printk (KERN_DEBUG "NEW num_symtab %lu\n" , nsyms); symhdr->sh_size = nsyms *sizeof (Elf_Sym);return module_bug_finalize (hdr, sechdrs, me); }
arch/powerpc/kernel/module_64.c +10 -11
@@ -26,6 +26,10 @@#include <asm/firmware.h> #include "setup.h" +#ifdef MODULES_DEBUG +#define DEBUG 1 +#endif +#include <linux/kernel.h> /* FIXME: We don't do .init separately. To do this, we'd need to have a separate r2 value in the init and core section, and stub between
@@ -34,11 +38,6 @@Using a magic allocator which places modules within 32MB solves this, and makes other things simpler. Anton? --RR. */ -#if 0 -#define DEBUGP printk -#else -#define DEBUGP (fmt , ...) -#endif /* There's actually a third entry here, but it's unused */ struct ppc64_opd_entry
@@ -129,8 +128,8 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr,/* Every relocated section... */ for (i =1 ; i < hdr->e_shnum; i++) {if (sechdrs[i].sh_type =SHT_RELA ) { -DEBUGP ("Found relocations in section %u\n" , i); -DEBUGP ("Ptr: %p. Number: %lu\n" , +printk (KERN_DEBUG "Found relocations in section %u\n" , i); +printk (KERN_DEBUG "Ptr: %p. Number: %lu\n" , (void *)sechdrs[i].sh_addr, sechdrs[i].sh_size /sizeof (Elf64_Rela)); relocs += count_relocs((void *)sechdrs[i].sh_addr,
@@ -139,7 +138,7 @@ static unsigned long get_stubs_size(const Elf64_Ehdr *hdr, } } -DEBUGP ("Looks like a total of %lu stubs, max\n" , relocs); +printk (KERN_DEBUG "Looks like a total of %lu stubs, max\n" , relocs);return relocs *sizeof (struct ppc64_stub_entry ); }
@@ -259,7 +258,7 @@ static inline int create_stub(Elf64_Shdr *sechdrs, me->name, (void *)reladdr, (void *)my_r2);return 0 ; } -DEBUGP ("Stub %p get data from reladdr %li\n" , entry, reladdr); +printk (KERN_DEBUG "Stub %p get data from reladdr %li\n" , entry, reladdr); *loc1 =PPC_HA (reladdr); *loc2 =PPC_LO (reladdr);
@@ -320,7 +319,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,unsigned long *location;unsigned long value; -DEBUGP ("Applying ADD relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying ADD relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rela); i++) {/* This is where to make the change */
@@ -330,7 +329,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, sym = (Elf64_Sym *)sechdrs[symindex].sh_addr +ELF64_R_SYM (rela[i].r_info); -DEBUGP ("RELOC at %p: %li-type as %s (%lu) + %li\n" , +printk (KERN_DEBUG "RELOC at %p: %li-type as %s (%lu) + %li\n" , location, (long )ELF64_R_TYPE (rela[i].r_info), strtab + sym->st_name, (unsigned long )sym->st_value, (long )rela[i].r_addend);
arch/s390/kernel/module.c +4 -6
@@ -29,15 +29,13 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> #include <linux/moduleloader.h> #include <linux/bug.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP (fmt , ...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> #ifndef CONFIG_64BIT #define PLT_ENTRY_SIZE 12
@@ -379,7 +377,7 @@ apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,unsigned long i, n;int rc; -DEBUGP ("Applying relocate section %u to %u\n" , +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info); base = sechdrs[sechdrs[relsec].sh_info].sh_addr; symtab = (Elf_Sym *) sechdrs[symindex].sh_addr;
arch/sh/kernel/module.c +4 -6
@@ -19,13 +19,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef SH_CPU_FREQ_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -89,7 +87,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,uint32_t value;int align; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
arch/sh64/kernel/module.c +10 -12
@@ -26,13 +26,11 @@#include <linux/vmalloc.h> #include <linux/fs.h> #include <linux/string.h> -#include <linux/kernel.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) +#ifdef PCI_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -73,7 +71,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,int align;int is_shmedia; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rel); i++) {/* This is where to make the change */
@@ -98,32 +96,32 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,switch (ELF32_R_TYPE (rel[i].r_info)) {case R_SH_DIR32 : -DEBUGP ("R_SH_DIR32 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); +printk (KERN_DEBUG "R_SH_DIR32 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); *location += relocation;break ;case R_SH_REL32 : -DEBUGP ("R_SH_REL32 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); +printk (KERN_DEBUG "R_SH_REL32 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); relocation -= (Elf32_Addr ) location; *location += relocation;break ;case R_SH_IMM_LOW16 : -DEBUGP ("R_SH_IMM_LOW16 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); +printk (KERN_DEBUG "R_SH_IMM_LOW16 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); *location = (*location & ~0x3fffc00 ) | ((relocation &0xffff ) <<10 );break ;case R_SH_IMM_MEDLOW16 : -DEBUGP ("R_SH_IMM_MEDLOW16 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); +printk (KERN_DEBUG "R_SH_IMM_MEDLOW16 @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); *location = (*location & ~0x3fffc00 ) | (((relocation >>16 ) &0xffff ) <<10 );break ;case R_SH_IMM_LOW16_PCREL : -DEBUGP ("R_SH_IMM_LOW16_PCREL @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); +printk (KERN_DEBUG "R_SH_IMM_LOW16_PCREL @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); relocation -= (Elf32_Addr ) location; *location = (*location & ~0x3fffc00 ) | ((relocation &0xffff ) <<10 );break ;case R_SH_IMM_MEDLOW16_PCREL : -DEBUGP ("R_SH_IMM_MEDLOW16_PCREL @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); +printk (KERN_DEBUG "R_SH_IMM_MEDLOW16_PCREL @%08lx = %08lx\n" , (unsigned long ) location, (unsigned long ) relocation); relocation -= (Elf32_Addr ) location; *location = (*location & ~0x3fffc00 ) | (((relocation >>16 ) &0xffff ) <<10 );
arch/v850/kernel/module.c +6 -8
@@ -14,16 +14,14 @@* Derived in part from arch/ppc/kernel/module.c */ -#include <linux/kernel.h> #include <linux/vmalloc.h> #include <linux/moduleloader.h> #include <linux/elf.h> -#if 0 -#define DEBUGP printk -#else -#define DEBUGP (fmt , ...) +#ifdef MODULES_DEBUG +#define DEBUG 1#endif +#include <linux/kernel.h> void *module_alloc (unsigned long size) {
@@ -85,8 +83,8 @@ static unsigned long get_plt_size(const Elf32_Ehdr *hdr,continue ;if (sechdrs[i].sh_type =SHT_RELA ) { -DEBUGP ("Found relocations in section %u\n" , i); -DEBUGP ("Ptr: %p. Number: %u\n" , +printk (KERN_DEBUG "Found relocations in section %u\n" , i); +printk (KERN_DEBUG "Ptr: %p. Number: %u\n" , (void *)hdr + sechdrs[i].sh_offset, sechdrs[i].sh_size /sizeof (Elf32_Rela)); ret += count_relocs((void *)hdr
@@ -176,7 +174,7 @@ int apply_relocate_add (Elf32_Shdr *sechdrs, const char *strtab,unsigned int i;Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; -DEBUGP ("Applying relocate section %u to %u\n" , relsec, +printk (KERN_DEBUG "Applying relocate section %u to %u\n" , relsec, sechdrs[relsec].sh_info);for (i =0 ; i < sechdrs[relsec].sh_size /sizeof (*rela); i++) {
init/Kconfig +5 -0
@@ -676,6 +676,11 @@ menuconfig MODULES If unsure, say Y. +config MODULES_DEBUG + bool "loadable module debugging" + depends on MODULES + default n + config MODULE_UNLOAD bool "Module unloading" depends on MODULES
kernel/module.c +21 -23
156 lines not on this page · raw message