Wednesday, July 20, 2011
12:30 PM

error while Installing kdb: traps.c:418: error: expected identifier or ‘(’ before ‘if’



While installing the kernel debugger(KDB) patches in Linux 2.6.32 you might encounter a few errors. Here are the work around.

To start with the installation you can follow the steps listed in
http://www.ibm.com/developerworks/linux/library/l-kdbug/

Once the patches are applied successfully, you will need to recompile the kernel. But make sure you enable the kernel debugger by setting the option
CONFIG_KDB=y 

On running make  The following are the errors you might encounter

1. arch/x86/kernel/traps.c:418: error: expected identifier or ‘(’ before ‘if’

The problem is with a brace in the traps.c file. at the line 415, which is an extra brace. So remove that brace.
2.   CC      drivers/usb/host/ehci-hcd.o
In file included from drivers/usb/host/ehci-hcd.c:312:
drivers/usb/host/ehci-q.c: In function ‘qh_completions_kdb’:
drivers/usb/host/ehci-q.c:701: error: ‘struct ehci_qh’ has no member named ‘hw_current’

This error is because the struct ehci_qh does not contain hw_current any more, it is present in a structure ehci_qh_hw . ehci_qh has a member
ehci_qh_hw *hw. Thus we need to use this "hw" pointer to get access to hw_current. So in the line 701 of the file drivers/usb/host/ehci-q.c
change
qh->hw_current 
to
qh->hw->hw_current

3.  CC      drivers/usb/host/ehci-hcd.o
In file included from drivers/usb/host/ehci-hcd.c:312:
drivers/usb/host/ehci-q.c: In function ‘qh_completions_kdb’:
drivers/usb/host/ehci-q.c:702: error: ‘struct ehci_qh’ has no member named ‘hw_token’


The member hw_token has also been moved to the structure ehci_qh_hw hence in the lines of the file drivers/usb/host/ehci-q.c 702, 708 and 710 change
qh->hw_token
to
qh->hw->hw_token

4. drivers/usb/host/ehci-q.c: In function ‘qh_completions_kdb’:
drivers/usb/host/ehci-q.c:765: error: ‘struct ehci_qh’ has no member named ‘hw_qtd_next’
drivers/usb/host/ehci-q.c:765: error: ‘struct ehci_qh’ has no member named ‘hw_info2’

Both these members are present in the structure ehci_qh_hw hence change in the lines of the file drivers/usb/host/ehci-q.c 765 and 775 change
qh->hw_qtd_next
to
qh->hw->hw_qtd_next

and
qh->hw_info2 
to 
qh->hw->hw_info2

5. drivers/usb/host/ehci-q.c:776: error: implicit declaration of function ‘intr_deschedule’ 

The functions intr_deschedule has been declared in ehci-sched.c but we need to inform ehci-q.c about it so add this line at the top of
the file drivers/usb/host/ehci-q.c
extern void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)

and from the file drivers/usb/host/ehci-sched.c  remove the static before the declaration of intr_deschedule. (line 628).

Once the above 5 changes are done, your kernel should compile with out any errors.


0 comments:

Post a Comment