LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-25-2018, 11:44 PM   #1
Omar_A
LQ Newbie
 
Registered: Apr 2018
Distribution: RHEL 7.1
Posts: 4

Rep: Reputation: Disabled
vmlinux missing symbols for spi-xilinx.c


I am trying to debug spi-xilinx.c using kgdb. The symbols for spi-xilinx.c are not in vmlinux.

I'm looking for symbols as follows:
$nm vmlinux | grep xilinx
$

I included CONFIG_SPI_XILINX in my kernel and built it per these instructions:
https://wiki.centos.org/HowTos/Custom_Kernel

Note that I am using RHEL 7 but the centos instructions worked well for me.

I verified that the module was in fact included in the kernel as follows:

$ grep xilinx /proc/kallsyms
ffffffff81487220 t xilinx_spi_setup
ffffffff81487230 t xilinx_spi_irq
ffffffff814872d0 t xilinx_spi_txrx_bufs
ffffffff814874b0 t xilinx_spi_setup_transfer
ffffffff81487520 t xilinx_spi_chipselect
ffffffff81487610 T xilinx_spi_deinit
ffffffff81487680 t xilinx_spi_remove
ffffffff814876b0 T xilinx_spi_init
ffffffff81487a60 t xilinx_spi_probe
ffffffff8174f3c0 r xilinx_spi_of_match
ffffffff819b5330 r __ksymtab_xilinx_spi_deinit
ffffffff819b5340 r __ksymtab_xilinx_spi_init
ffffffff819c9fc8 r __kcrctab_xilinx_spi_deinit
ffffffff819c9fd0 r __kcrctab_xilinx_spi_init
ffffffff819e8968 r __kstrtab_xilinx_spi_deinit
ffffffff819e897a r __kstrtab_xilinx_spi_init
ffffffff81addf80 d xilinx_spi_driver
ffffffff81babf1f t xilinx_spi_driver_init
ffffffff81cdb170 t __initcall_xilinx_spi_driver_init6
ffffffff81cffdf3 t xilinx_spi_driver_exit

I selected kernel config options as indicated in kernel doc for kgdb:

# CONFIG_DEBUG_RODATA is not set

CONFIG_FRAME_POINTER=y

CONFIG_KGDB=y

CONFIG_KGDB_SERIAL_CONSOLE=y

I need the xilinx symbols in vmlinux so I can do source code level debug of spi-xilinx.c. What am I missing here? How do I get vmlinux to include spi-xilinx.c symbols?

Thank you for taking the time to help.
 
Old 04-26-2018, 04:48 AM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
How did you configure the xilinx driver in your kernel? The CONFIG_ option should be saying =y and not =m. Please check this.
 
Old 04-26-2018, 10:27 PM   #3
Omar_A
LQ Newbie
 
Registered: Apr 2018
Distribution: RHEL 7.1
Posts: 4

Original Poster
Rep: Reputation: Disabled
Yes:

CONFIG_SPI_XILINX=y
 
Old 04-27-2018, 12:06 AM   #4
Omar_A
LQ Newbie
 
Registered: Apr 2018
Distribution: RHEL 7.1
Posts: 4

Original Poster
Rep: Reputation: Disabled
I decided to try building spi-xilinx.c as a module:

CONFIG_SPI_XILINX=m

The resulting loadable modules generated during the kernel build did not have debug info either. However, I was able to build spi-xilinx.c outside the kernel source tree with this makefile which includes the -g option:

obj-m := spi-xilinx.o
MY_CFLAGS += -g -DDEBUG
ccflags-y += ${MY_CFLAGS}
CC += ${MY_CFLAGS}

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
MODULES=$(obj-m:.o=.ko)
XZ_MODULES=$(MODULES:.ko=.ko.xz)

all:
$(MAKE) -C $(KERNELDIR) M=$(PWD)

The resulting loadable module includes debug info. And I can also debug by adding printk statements.

I would still like to know why vmlinux does not contain debug info for components I included as "built-in", i.e.,

CONFIG_SPI_XILINX=y
 
Old 05-03-2018, 11:56 AM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
In the 'kernel hacking' section of the config, select 'compile kernel with debug info'.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] why does kgdb not how function symbols when debugging vmlinux? 915086731 Linux - Kernel 2 04-11-2018 06:56 AM
[SOLVED] Missing symbols when trying to load snd_hda_intel hazel Linux - Kernel 1 07-15-2017 11:21 AM
LKMs, missing symbols, etc. xoi Linux - General 1 06-18-2006 02:03 AM
Missing symbols Unreal 2004 spoody_goon Linux - Games 5 10-20-2004 03:58 PM
UT2004 Missing Symbols - Crashes jwoair23 Linux - Games 40 08-08-2004 06:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration