473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

working c program dies in gdb

Hi all,

Can anyone help me with the following dilema:
I have been provided with a 3rd party threaded library (say libfoo.a)
believed to be stable, it has been in use for a few years and noone has
complained about
it crashing.

The program seems to run fine.

//pseudo c-code
main()
{
statement_a;
statement_b;
call_to_function_in_lib_foo();
statement_c;
statement_d;
}

I want to run this in the debugger and experiment with some variations
in statement_c or d
BUT when I run the code in the debugger (gdb) the program generates a
segment fault in call_to_function_in_lib_foo (after spawing some
threads) but before ever executing anything on
statement_c;

If I run the program from the command line outside the debugger
and attach the debugger to the running process,
the debugger notes that there are 6 threads active, but when I try to
debug entirely in the debugger, it only gets to 4 threads and then
seg-faults.

Any ideas on why the program would work normally but fail when run in a
debugger? and any
ideas on how to resolve this?
Is this a debugger issue? library issue? (using gdb 5.3.9)

Thanks in advance...
Doug

Jan 11 '07 #1
2 1440
doug said:

<snip>
Any ideas on why the program would work normally but fail when run in a
debugger?
Yes. The program is exhibiting undefined behaviour. That is, it contains a
bug.
and any ideas on how to resolve this?
Fix the bug.
Is this a debugger issue? library issue? (using gdb 5.3.9)
Programmer issue.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jan 11 '07 #2
I don't see ur exact code. here is my guess.
maybe you pass local variables to the thread creation functions. If you are
lucky enough the program can run without crashing at some chances.
but if you use a debugger things r different because the execution sequence
changed.
Just a guess. you can use bt to find out what you passed to the library
routine. Be sure they are independent to the execution sequence of threads.
BR

"doug" <db*******@yahoo.comwrote in message
news:11**********************@p59g2000hsd.googlegr oups.com...
Hi all,

Can anyone help me with the following dilema:
I have been provided with a 3rd party threaded library (say libfoo.a)
believed to be stable, it has been in use for a few years and noone has
complained about
it crashing.

The program seems to run fine.

//pseudo c-code
main()
{
statement_a;
statement_b;
call_to_function_in_lib_foo();
statement_c;
statement_d;
}

I want to run this in the debugger and experiment with some variations
in statement_c or d
BUT when I run the code in the debugger (gdb) the program generates a
segment fault in call_to_function_in_lib_foo (after spawing some
threads) but before ever executing anything on
statement_c;

If I run the program from the command line outside the debugger
and attach the debugger to the running process,
the debugger notes that there are 6 threads active, but when I try to
debug entirely in the debugger, it only gets to 4 threads and then
seg-faults.

Any ideas on why the program would work normally but fail when run in a
debugger? and any
ideas on how to resolve this?
Is this a debugger issue? library issue? (using gdb 5.3.9)

Thanks in advance...
Doug

Jan 20 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ben arthur | last post by:
what happens to java if sun dies? i'm a developer and am pondering using java for a new project. but am worried about sun's future. ben
0
by: Gumby | last post by:
Is gprof on Solaris 9 X86 not as supported as Solaris 9 Sparc? At work when we try to compile a program with -pg to use gprof to performance profile our software, the compiled app just dies...
4
by: Casual Reader | last post by:
Hi, I have a C# program that in principle should only use a constant amount of memory to execute (with periodic garbage collection) and in fact does so when executed in Mono under either Windows...
2
by: I appreciate your help.... anony | last post by:
Hi, does anyone know whether it is possible to have a holding page for when an application domain dies and give the "503" error, we would like to replace that error a holding page. Can some one...
4
by: vagrantbrad | last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the...
1
by: codeinthedark | last post by:
I'm hoping someone will be able to help me with an issue relating to working with unmanaged C++. I've been able to get most things working with regard to mapping from unmanaged C++ to C#, but the...
4
by: TwistedPair | last post by:
All, Been trying to get a little program to work, and I think I'm really close, but I'm afraid I need to be pointed in the right direction. The code below will watch a directory for files...
7
by: Brian | last post by:
I'm trying to run a select max() on a primary key/unique/non-identity column then + 1, all while running an insert into.. select statement. For some reason, the select max isn't quite doing the...
15
by: Lawrence Krubner | last post by:
Does anything about this script look expensive, in terms of resources or execution time? This script dies after processing about 20 or 25 numbers, yet it leaves no errors in the error logs. This is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.