You are not logged in.
Hi ,
I downloaded the source codes of hdparm 9.43 and trying to trace the routine with GDB. I modified the Makefile, make clean and make all again.
But after that I always can't find any debug symbols within executable hdparm like following output.
root@debian:/tools/hdparm-9.43# nm hdparm
nm: hdparm: no symbols
Here's my Makefile:
root@debian:/tools/hdparm-9.43# diff Makefile Makefile_mod
13,14c13,15
< CC ?= gcc
< STRIP ?= strip
---
> CC ?= gcc
> #STRIP ?= strip
> STRIP ?=
16c17
< CFLAGS := -O2 -W -Wall -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs $(CFLAGS)
---
> CFLAGS := -W -Wall -ggdb -O1 -Wbad-function-cast -Wcast-align -Wpointer-arith -Wcast-qual -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -fkeep-inline-functions -Wwrite-strings -Waggregate-return -Wnested-externs -Wtrigraphs
18,19c19,20
< LDFLAGS = -s
< #LDFLAGS = -s -static
---
> #LDFLAGS = -s
> LDFLAGS = -ggdb -O1 -s -static
30,31c31,32
< $(CC) $(LDFLAGS) -o hdparm $(OBJS)
< $(STRIP) hdparm
---
> $(CC) $(LDFLAGS) -o hdparm $(OBJS)
> #$(STRIP) hdparm
I also tried -g but doesn't work
is there someone know how to compiled hdparm with debug symbols ?
Thanks
Hao
Last edited by joker_hao (2013-07-03 09:24:36)
Offline
Sorry, my gcc version 4.7.1 (Debian 4.7.1-7)
Offline
Offline
Offline
-ggdb should go to CFLAGS only (althouth it won't do harm probably in LDFLAGS). Also remove -s (which will strip debug symbols) from the LDFLAGS.
Oh, I am so fool,
root@debian:/tools/hdparm-9.43#ld --help
....
-s, --strip-all Strip all symbols
I removed the -s from LDFLAGS, it finally does the work !
Thank you
Offline