public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Ramana Radhakrishnan <ramana.radhakrishnan@codito.com>
To: larry@software-horizons.com
Cc: gdb@sources.redhat.com
Subject: Re: gdb runs multi-threaded with non-threaded app and gets SEGV
Date: Fri, 15 Jul 2005 19:51:00 -0000	[thread overview]
Message-ID: <1121456545.7681.5.camel@localhost.localdomain> (raw)
In-Reply-To: <20050715182533.84905.qmail@web52009.mail.yahoo.com>

On Fri, 2005-07-15 at 11:25 -0700, Larry Martell wrote:
> I have a program that has 1 line of code - a call to
> a third party libary function:
> 
> #include "ni488.h"
> 
> int main() {
>         int handle = ibdev(0, 7, 0, 10, 1, 0);
> }


That is not enough info for us to help you with . Try CVS head or a more
recent version of gdb and see if that works. Whats the version of libc ,
gcc that you are building your app with ? Also maybe your 3rd party
library might be multithreaded for all we know. Do a ldd on the library
if its a .so and check .

cheers
Ramana


> 
> The program is not multi-threaded nor does not link
> with any multi-threaded libs. It's built like this:
> 
> gcc -g -o nitest nitest.c -lgpibapi
> 
> If I run the program outside of the debugger it does
> not crash.
> 
> If I run it from within gdb here's what I get:
> 
> $ gdb nitest
> GNU gdb 6.2-2mdk (Mandrakelinux)
> 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
> "i586-mandrake-linux-gnu"...Using host libthread_db
> library "/lib/tls/libthread_db.so.1".
> 
> (gdb) start
> Breakpoint 1 at 0x8048398: file nitest.c, line 4.
> Starting program: /home/martell/src/nitest2/nitest
> [Thread debugging using libthread_db enabled]
> [New Thread 1076484320 (LWP 9873)]
> [Switching to Thread 1076484320 (LWP 9873)]
> main () at nitest.c:4
> 4               int handle = ibdev(0, 7, 0, 10, 1, 0);
> (gdb) c
> Continuing.
> [New Thread 1085078448 (LWP 9876)]
> [New Thread 1093471152 (LWP 9877)]
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 1085078448 (LWP 9876)]
> 0x4005d609 in ?? () from
> /usr/local/lib/libgpibapi.so.2
> 
> Can anyone tell me why gdb runs this as multi-threaded
> and why I get a SEGV in gdb, but I do not when I run
> it outside of gdb?
> 
> Thanks!
> -larry

  reply	other threads:[~2005-07-15 19:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-15 18:25 Larry Martell
2005-07-15 19:51 ` Ramana Radhakrishnan [this message]
2005-07-15 21:03   ` Larry Martell
2005-07-15 21:30     ` Min Xu (Hsu)
2005-07-15 22:24       ` Larry Martell
2005-07-15 23:04         ` Min Xu (Hsu)
2005-07-16  0:52           ` Larry Martell
2005-07-18 16:01             ` Larry Martell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1121456545.7681.5.camel@localhost.localdomain \
    --to=ramana.radhakrishnan@codito.com \
    --cc=gdb@sources.redhat.com \
    --cc=larry@software-horizons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).