Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: Re: [Wireshark-users] Trying to get Wireshark up and running via MacPorts

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Fri, 23 Nov 2007 18:27:07 -0700
On Fri, Nov 23, 2007 at 07:49:48PM -0500, Kok-Yong Tan wrote:

> I'm currently in the middle of a "sudo port -Rv install wireshark"
> after doing a "sudo port clean wireshark".  I'll try downloading the
> source and then building directly after my build using MacPorts. 
> However, I haven't used gdb in over fifteen years (used to be a
> developer, got sent to the abyss of systems administration and haven't
> clawed my way back out yet) so I'd appreciate a refresher on getting
> the backtrace via gdb.  Thanks in advance.

When you have the source build manually in the build directory, you'll
want to use glibtool (normally named libtool, except on OS X, which has
a libtool program that does something totally different) to run
Wireshark through the gdb debugger.  I'll create a breakpoint in gdb to
simulate the program stopping at an error like you're getting (I will
erase the breakpoint setting command/output from below for your clarity
- it will crash on its own for you):

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
sfisher@shadow:/usr/local/src/wireshark>glibtool --mode=execute gdb ./wireshark
GNU gdb 6.3.50-20050815 (Apple version gdb-696) (Sat Oct 20 18:16:54 GMT 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...
warning: --arch option not supported in this gdb.
Reading symbols for shared libraries............................................... done

(gdb) run
Starting program: /usr/local/src/wireshark/.libs/wireshark 
Reading symbols for shared libraries ..................................................++................+++++++++++++++++++++++....+++++++++++++..+ done
Reading symbols for shared libraries . done
<above line repeats a bunch of times)

Breakpoint 1, commview_open (wth=0xb0ca650, err=0xbfffe8a8, err_info=0xbfffe86c) at commview.c:98
98              if(!commview_read_header(&cv_hdr, wth->fh, err))
(gdb) backtrace 10
#0  commview_open (wth=0xb0ca650, err=0xbfffe8a8, err_info=0xbfffe86c) at commview.c:98
#1  0x0070e5c4 in wtap_open_offline (filename=0xb0b5ae0 "/Users/sfisher/captures/commview/FormatShowcase1.ncf", err=0xbfffe8a8, err_info=0xbfffe86c, do_random=1) at file_access.c:341
#2  0x000117e4 in cf_open (cf=0x13d3d0, fname=0xb0b5ae0 "/Users/sfisher/captures/commview/FormatShowcase1.ncf", is_tempfile=0, err=0xbfffe8a8) at file.c:215
#3  0x00028f78 in menu_open_recent_file_cmd (w=0xb138970) at menu.c:1462
#4  0x07a6c66b in g_closure_invoke ()
#5  0x07a7d99d in signal_emit_unlocked_R ()
#6  0x07a7eb43 in g_signal_emit_valist ()
#7  0x07a7f1f7 in g_signal_emit ()
#8  0x012a8aad in gtk_widget_activate ()
#9  0x0114ead1 in gtk_menu_shell_activate_item ()
(More stack frames follow...)
(gdb) quit
The program is running.  Exit anyway? (y or n) y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

The important command is "backtrace 10," which shows the last 10 lines
of the backtrace of functions called.  This helps us see which function
the crash occured in and some clues as to why it crashed.

> Got a couple of lines of output from the MacPorts build which look
> suspicious, though (do they help pinpoint the possible problem with
> MacPort patches?):

That output looks normal.  We have cleared almost all of the warnings
from the code except for generated code, which those warnings are from.


Steve