這是我先前準備的小例子, 怎麼將 debug information 抽出, 然後再重新關聯上
/* test.c */
#include <stdlib.h>
int main()
{
abort();
return 0;
}
# Makefile
CFLAGS := -ggdb3
OBJCOPY := objcopy
STRIP := strip
test: test.o
$(CC) -o $@ $< $(CFLAGS)
$(OBJCOPY) --only-keep-debug $@ $@.debug
$(STRIP) --strip-debug --strip-unneeded $@
$(OBJCOPY) --add-gnu-debuglink=$@.debug $@
test.o: test.c
.PHONY: clean
clean:
rm -rf test test.o test.debug