Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jul 2008 12:41:46 -0700
From:      Edward Sutton <mirror176@hotmail.com>
To:        <freebsd-questions@freebsd.org>
Subject:   Any advice for learning debugging threading and stack corruption problems for c/c++?
Message-ID:  <BAY110-W5647DD3A86EA1C359F8D69E68F0@phx.gbl>

next in thread | raw e-mail | index | archive | help

  I have had a very hard time trying to debug which has hindered my work on=
 some projects.  In particular I have had trouble properly grasping how to =
work with debugging multi threaded applications=2C memory errors=2C and sta=
ck corruption. I know that it is not a five minute learning process to abso=
rb such knowledge=2C but I have not yet found helpful references. I have ha=
d best luck trying to logically guess a location close to the problem=2C th=
en setting a break and walking through the code. Once I hit a segfault=2C I=
 run through the code with a breakpoint bringing me to just before the prob=
lem=2C but do not always understand how to go further. Strange things I see=
 look like bad pointer addresses or the problems being caused within anothe=
r thread.
  Since moving to FreeBSD7=2C I have been unable to use valgrind (which did=
 not seem to help much on multi threaded apps) and I have not found a way t=
o test binaries in the work directories and have had to install it to test =
it. At present=2C either gdb alone or kdbg seem to be the only ways I have =
been able to get even partially reliable responses from gdb because other i=
nterfaces disregard breakpoints and interrupts to execution. Are such diffi=
culties common?
  On another similar topic=2C is there a good place to start learning about=
 limitations to system internals=2C such as kern.ipc.shmmax and why I may '=
not' want to set it to excessively high values or how other values relate t=
o changing it? How can I tell what cap is occurring=2C whether it be a syst=
em limit or something controlled within the app such as with pthread_attr_s=
etstacksize() and how are 'proper' values determined?
  The books "advanced programming in the unix environment" and "programming=
 with posix threads" help me learn the unix world a bit better=2C but witho=
ut debugging knowledge I find it hard to get anywhere with writing more tha=
n my high school level of programs and very difficult to get anywhere on th=
e projects of others once threads and/or dynamic memory is involved.
  Any suggested course for further study from here?
Thanks again=2C
Edward Sutton=2C III

_________________________________________________________________
Keep your kids safer online with Windows Live Family Safety.
http://www.windowslive.com/family_safety/overview.html?ocid=3DTXT_TAGLM_WL_=
family_safety_072008=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BAY110-W5647DD3A86EA1C359F8D69E68F0>