From owner-freebsd-questions@FreeBSD.ORG Wed Jul 16 19:53:45 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C9ED106566B for ; Wed, 16 Jul 2008 19:53:45 +0000 (UTC) (envelope-from mirror176@hotmail.com) Received: from bay0-omc1-s34.bay0.hotmail.com (bay0-omc1-s34.bay0.hotmail.com [65.54.246.106]) by mx1.freebsd.org (Postfix) with ESMTP id 808498FC0A for ; Wed, 16 Jul 2008 19:53:45 +0000 (UTC) (envelope-from mirror176@hotmail.com) Received: from BAY110-W56 ([65.54.229.156]) by bay0-omc1-s34.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 16 Jul 2008 12:41:46 -0700 Message-ID: X-Originating-IP: [98.165.138.223] From: Edward Sutton To: Date: Wed, 16 Jul 2008 12:41:46 -0700 Importance: Normal MIME-Version: 1.0 X-OriginalArrivalTime: 16 Jul 2008 19:41:46.0251 (UTC) FILETIME=[FB42C5B0:01C8E77B] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Any advice for learning debugging threading and stack corruption problems for c/c++? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jul 2008 19:53:45 -0000 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=