471,073 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

core dump on writing to pipe

Could you tell me scenarios in which core's dumped when writing to a
pipe.

write (pipefd,&Struct,structsize);

on windows too this give a memory "read" violation. Could anyone tell
me why.
thanks in advance.

mojo

Nov 14 '05 #1
8 2401
In article <11**********************@g14g2000cwa.googlegroups .com>,
mojozoox <ma*******@HotPop.com> wrote:
Could you tell me scenarios in which core's dumped when writing to a
pipe.
Pipes are not part of standard C. Can you repeat the
problem with writing to a file opened for binary output?

write (pipefd,&Struct,structsize); on windows too this give a memory "read" violation. Could anyone tell
me why.


structsize perhaps does not match sizeof(Struct) ?

The contents of Struct has perhaps not been initialized and
windows is perhaps detecting this?

pipefd might not be valid?

Struct might not even be the right type -- e.g., it might
really be a pointer to a structure and so you might be
taking the address of a pointer instead of passing
the address of a structure.
--
"[...] it's all part of one's right to be publicly stupid." -- Dave Smey
Nov 14 '05 #2
"mojozoox" <ma*******@HotPop.com> wrote:
# Could you tell me scenarios in which core's dumped when writing to a
# pipe.
#
# write (pipefd,&Struct,structsize);
#
# on windows too this give a memory "read" violation. Could anyone tell

How about adding fprintf(stderr,"%d %p %d\n',pipefd,&Struct,structsize)
and see if the output looks rational.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
What kind of convenience store do you run here?
Nov 14 '05 #3
SM Ryan wrote:
"mojozoox" <ma*******@HotPop.com> wrote:
Could you tell me scenarios in which core's dumped when writing
to a pipe.

write (pipefd,&Struct,structsize);

on windows too this give a memory "read" violation. Could anyone


How about adding fprintf(stderr,"%d %p %d\n',pipefd,&Struct,structsize)
and see if the output looks rational.


Apart from the fact that there is no write(...) function in
standard C, and that Windoze is not Posix (neither of which is
on-topic here), your suggested diagnostic is one of the few places
that really need a cast. In this case (void*)&Struct.

Please correct your unconventional quote char. I edited this to
fix it.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #4
CBFalconer <cb********@yahoo.com> writes:
SM Ryan wrote:
"mojozoox" <ma*******@HotPop.com> wrote:
Could you tell me scenarios in which core's dumped when writing
to a pipe.

write (pipefd,&Struct,structsize);

on windows too this give a memory "read" violation. Could anyone


How about adding fprintf(stderr,"%d %p %d\n',pipefd,&Struct,structsize)
and see if the output looks rational.


Apart from the fact that there is no write(...) function in
standard C, and that Windoze is not Posix (neither of which is
on-topic here), your suggested diagnostic is one of the few places
that really need a cast. In this case (void*)&Struct.


You might need casts for the other arguments as well. I'm guessing
pipefd is probably an int (if so, it doesn't need a cast), but
structsize is likely to be (and probably should be) a size_t.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #5
is there way to read a core file kindly let me know!

Nov 14 '05 #6
In article <11**********************@l41g2000cwc.googlegroups .com>,
mojozoox <ma*******@HotPop.com> wrote:
is there way to read a core file kindly let me know!


A core file is like any other binary file -- just fopen() it
and fread() it.

Making sense of what you find there is a platform- and version-
specific problem.
--
Beware of bugs in the above code; I have only proved it correct,
not tried it. -- Donald Knuth
Nov 14 '05 #7
mojozoox wrote:
is there way to read a core file kindly let me know!


Write a C program that opens it in binary more then reads it.

Alternatively, ask in a group dedicated to your system since we don't
deal with implementation specific tools here.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 14 '05 #8
"mojozoox" <ma*******@HotPop.com> wrote:
# is there way to read a core file kindly let me know!

The debugger on your system. Perhaps gdb or sdb or dbg or dbx or mky mus.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
So basically, you just trace.
Nov 14 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Nick Craig-Wood | last post: by
6 posts views Thread by John Liu | last post: by
10 posts views Thread by ken | last post: by
3 posts views Thread by John Liu | last post: by
6 posts views Thread by wenmang | last post: by
10 posts views Thread by wong_powah | last post: by
4 posts views Thread by Aidan | last post: by
5 posts views Thread by johnericaturnbull | last post: by

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.