Nmap Development mailing list archives

Re: How to debug a segmentation fault


From: Brett Hutley <brett () hutley net>
Date: Thu, 9 Nov 2006 13:07:05 +0000

On Thu, Nov 09, 2006 at 06:06:11AM -0500, Douglas F. Calvert wrote:
Hello,
 I am testing out nmap4.20a11 with linux 2.6.19-rc5. I am getting a lot
of segmentation faults when I scan with:

nmap -sV -O -n -oA basename -PE --version_all --allports
--randomize_hosts -n -v -v --max_retries 3 --log-errors -d5
1.1.14-16.1-254 > nmap.out  2>&1

*snip*
 
How would I go about figuring out why nmap is dying?

Typically you would compile with nmap debug enabled (the "-g" option
in gcc), then start gdb with the nmap binary.

shell$ gdb nmap

(gdb) set args -sV -O -n -oA basename -PE --version_all --allports (etc)

(gdb) run

When the program segfaults, type "up" to move up the stack frame
until you can see the line of the source code that is causing the
segfault (usually overwriting memory, or NULL pointer or some such).

I like running gdb under Emacs, so I can see the source code
easily, if you're not experienced with Emacs then that probably
isn't a good idea.

HTH, Brett

-- 
Brett Hutley
mailto:brett () hutley net
http://hutley.net/brett/

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: