Need help on Bus error(coredump)


 
Thread Tools Search this Thread
Operating Systems HP-UX Need help on Bus error(coredump)
# 1  
Old 02-17-2009
Need help on Bus error(coredump)

Hi all,

I am quite weak in C but I need to get some work done. Hope someone can help me out. I keep getting this error when i try to run my C application in my HP-UX 10.20 machine.

Some code snippet:

Code:
Month(DBTime) =====This is a function which will return variable "CutOffTime" to be use below
strcpy(DBSecTime, CutOffTime)
sprintf(str, "DBSecTime is : %s\n", DBSecTime);
InputLog(Log, str);

exec sql begin works;
sprintf(str, "DBSecTime is : %s\n", DBSecTime);
InputLog(Log, str);

exec sql select * from tableA where time < :DBSecTime

exec sql commit work;

I am able to print out values of DBSecTime on every sprintf until I reach the sql statement, following which, a Bus error(coredump) will appear.

Hope someone is able to give me some advices. Thanks in advance. Smilie
# 2  
Old 02-17-2009
You should include more code, such as the declaration of DBSecTime. And what is this ?
Code:
exec sql select * from tableA where time < :DBSecTime

That's not C code.
# 3  
Old 02-17-2009
Lets start simple:
What does
Code:
 file core

return?
# 4  
Old 02-17-2009
Quote:
Originally Posted by otheus
You should include more code, such as the declaration of DBSecTime. And what is this ?
Code:
exec sql select * from tableA where time < :DBSecTime

That's not C code.

Hi otheus, sorry about that, I have included more codes.

Code:
exec sql begin declare section;
char DBSecTime[15];
exec sql end declare section;

Month(DBTime) ===== This is a function which will return variable "CutOfftime" to be use below:
strcpy(DBSecTime, CutOffTime)
sprintf(str, "DBSecTime is : %s\n", DBSecTime);
InputLog(Log, str);

exec sql begin works;
sprintf(str, "DBSecTime is : %s\n", DBSecTime);
InputLog(Log, str);

exec sql select * from tableA where time < :DBSecTime

exec sql commit work;

exec sql select * from tableA where time < : DBSecTime, this is actually a embedded sql statement in my C code. I just find it strange that the 2 sprintf statement was able to run smoothly but not the DBSecTime that was in the sql statement. I have even try to replace DBSecTime in the sql statement with a value like "200812000000" and it managed to got thru too. Smilie

Last edited by Vision©; 02-17-2009 at 09:41 PM.. Reason: Additional Info
# 5  
Old 02-17-2009
Quote:
Originally Posted by vbe
Lets start simple:
What does
Code:
 file core

return?
Hi vbe, file core return
core: core file from 'Test.exe' - received SIGBUS
# 6  
Old 02-18-2009
Ah. you haven't nul-terminated DBSecTime!! C won\t do that for unless you tell it to.

char DBSecTime[15] = { 0 };
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Bus Error: 10...Help please!

Hi all, I am writing a phonebook program to store names and number using a list. Here is the code for the function which allows the user to enter the name and number (where the error occurs). //THIS FUNCTION ADDS A NEW ENTRY TO THE phonebook_list void insert(void){ //variables int... (5 Replies)
Discussion started by: kdejan
5 Replies

2. Programming

Bus error

Hi everyone, I have a GUI project and when I run it and left in idle state for a long time(there is nothing done, just opened GUI, no more actions),I get bus error after trying to do anything with it. I've tried to build it in debug mode and use gdb, but I don't get any error in debug mode.It... (3 Replies)
Discussion started by: sisi
3 Replies

3. HP-UX

Bus Error

I am getting bus error when i include "#!/bin/ksh". If i remove interpreter then script is working. Can anyone explain this and how can i avoid this error? Operating System is HP-UX B.11.23 U 9000/800 1091834454 (2 Replies)
Discussion started by: anbu23
2 Replies

4. UNIX for Advanced & Expert Users

Segmentation (CoreDump) error !!

Hi all, I am trying to create few directories using script and its giving me segmentation error. #!/bin/ksh createDirectories() createDirectories() { cat dirs | \ while read line do mkdir... (16 Replies)
Discussion started by: varungupta
16 Replies

5. UNIX for Dummies Questions & Answers

bus error (coredump)

Hi all, I am getting bus error problem in SunOS. Can you please help me out in this regard. Actually, my entire code till the last line has been executed. But after tht i am getting a bus error. Please help me. Thanks in advance. Charu. (4 Replies)
Discussion started by: charu
4 Replies

6. UNIX for Advanced & Expert Users

Bus error(coredump) while running SQL*Loader in HP Unix 11

Hi All, I am getting coredump error, when I try to execute Oracle SQL*Loader from Shell script in Unix environment. But SQL*Loader from local machine runs fine with same database. SQL*Loader: Release 9.2.0.6.0 - Production on Mon Apr 23 05:23:47 2007 Copyright (c) 1982, 2002, Oracle... (3 Replies)
Discussion started by: srinivas_paluku
3 Replies

7. Programming

BUS error

Hi! I've got a program which runs fine under Linux, but I have compiled it to run under SunOS 5.8 in a Sparc computer, and now it sometimes fails with "bus error". Ussing gdb I surfed to the error line, which is *pointer = some_vector; where some_vector is a 16 byte struct (4 integers)... (1 Reply)
Discussion started by: shesatmine
1 Replies

8. UNIX for Advanced & Expert Users

Bus Error(coredump)

Hi, I am using HP-UX. While i try to run the Sqlplus command using the shel script in encounter the following error: <shell script name>: some number Bus Error(coredump) What may be the reason behind this. I read few previous threads in this forum where i found some similar case. There it was... (2 Replies)
Discussion started by: Jayesh
2 Replies

9. UNIX for Dummies Questions & Answers

Bus error(coredump

aix 5.3 ML1 system was functioing well, when suddenly telnet session hung and then I got the following message "Bus error(coredump)" would appreciate if anyone would assist as to what to do next. (3 Replies)
Discussion started by: Student37
3 Replies

10. UNIX for Dummies Questions & Answers

Bus Error

This may belong in the C Programming forum, but here goes anyway... What would cause a bus error? I searched google for a cause, but came up with some conflicting reports... Could it be caused by disk space? A lot of the pages I found mentioned linking with the incorrect versions of the... (4 Replies)
Discussion started by: LivinFree
4 Replies
Login or Register to Ask a Question