Hoang
Hoang

Reputation: 55

Debug command route in Linux

I want to debug a command line in Linux.

$ route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.3.10

With command line above, I want to know how Linux kernel handles it. I am doing project about Routing Table, and I will be demo with this. When run this command, kernel executes what, which function the kernel calls (ie: lookup(), fib_tale_insert()...), and how to show value of command when I debug.

I am trying with "strace" but I can't. Can you help me?

Upvotes: 0

Views: 1364

Answers (1)

francesco foresti
francesco foresti

Reputation: 2043

First of all, you'll have to recompile the kernel with debug info enabled, see these pages for further information :

https://serverfault.com/questions/251134/how-to-compile-the-kernel-with-debug-symbols

and

https://www.kernel.org/pub/linux/kernel/people/jwessel/kdb/CompilingAKernel.html

(In a nutshell, You need CONFIG_DEBUG_INFO=y on the config.)

You could also find some already-compiled kernels with debug enabled, but this will depend on the distribution you are using.

Upvotes: 1

Related Questions