Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Collecting Shared Memory in core dump Post 302907310 by rupeshkp728 on Friday 27th of June 2014 07:59:09 AM
Old 06-27-2014
Collecting Shared Memory in core dump

I have an application which crashed while accessing a shared memory.
Code:
typedef struct
{
...
} LnxUserData;

LnxUserData *ptrLnxUserData;

fd = shm_open(shrSegName, O_CREAT|O_RDWR|O_EXCL, 0644);
if(fd == -1 && errno == EEXIST)
{
    fd = shm_open(shrSegName, O_CREAT|O_RDWR, 0644);
}
ptrLnxUserData = mmap(0, sizeof(LnxUserData), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

But in the core when I try to access the memory it gives me error

Code:
(gdb) p *ptrLnxUserData
Cannot access memory at address 0xeb80d050

This may be probably because core does not collect the shared memory details.
So when an application pointer which had address of the shared memory is accessed it is not able to access it inside core.

Is there any way or any dump setting through which shared memory or its details can also be collected in core?

Last edited by rupeshkp728; 06-29-2014 at 05:58 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help, what is the difference between core dump and panic dump?

help, what is the difference between core dump and panic dump? (1 Reply)
Discussion started by: aileen
1 Replies

2. UNIX for Dummies Questions & Answers

core dump

does any one have read a core dump? is there any reader for that? or may i know what is the use of that core which takes sometimes memory in GBs? :) (6 Replies)
Discussion started by: sskb
6 Replies

3. UNIX for Dummies Questions & Answers

core dump

Hi , Working on AIX 4.3. An internal error from my apps engine suddenly causes the engine to die. During this time i do notice a core file being dumped in the directory from where I try to re-start my engine. Q is how does one read this core file, or I should say 'what is this core file'? thnx (2 Replies)
Discussion started by: buRst
2 Replies

4. UNIX for Advanced & Expert Users

Shared memory shortage but lots of unused memory

I am running HP-UX B.11.11. I'm increasing a parameter for a database engine so that it uses more memory to buffer the disk drive (to speed up performance). I have over 5GB of memory not being used. But when I try to start the DB with the increased buffer parameter I get told. "Not... (1 Reply)
Discussion started by: cjcamaro
1 Replies

5. UNIX for Dummies Questions & Answers

Core dump in HP-UX..

Hi All I am new for this forum. I have a core file by using gdb and bt cmd I got the function name but I want to the exact cause of the core dump because of I can not reproduse the binary so if any one know the cmd plz plz plz let me know. (0 Replies)
Discussion started by: gyanusoni
0 Replies

6. Programming

core dump

how to view core dumped file using gdb and how to extract information from the coredumped file.can we get similar information from the other utilites like strace or ptrace. (2 Replies)
Discussion started by: Manabhanjan
2 Replies

7. HP-UX

memory fault(core dump)

i am getting memory fault (core dump) in a C program i want to know which statement execution caused it. i tried following things $ gdb generalised_tapinread_mod HP gdb 5.4.0 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x. Copyright 1986 - 2001 Free Software Foundation, Inc.... (2 Replies)
Discussion started by: junaid.nehvi
2 Replies

8. UNIX for Advanced & Expert Users

collecting memory usage by a process

Hi Guys, I work on a AIX environment and I'm trying to write a script where I can collect all the memory used by a process. Basically I'm executing the command 'ps -fu userid' to get all the process ids and then executing the 'ps v PID' to get all the memory allocated by PPID. My question is... (2 Replies)
Discussion started by: arizah
2 Replies

9. Programming

Shared library with acces to shared memory.

Hello. I am new to this forum and I would like to ask for advice about low level POSIX programming. I have to implement a POSIX compliant C shared library. A file will have some variables and the shared library will have some functions which need those variables. There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies

10. Solaris

core dump

Hi guys, just want to know which core file pattern is best to set for core dumps: 1) per-process file name pattern or 2) global file name pattern. I will really appreciate an explanation why the chosen one is better. Thanks a lot guys. (2 Replies)
Discussion started by: cjashu
2 Replies
shm_open(3C)						   Standard C Library Functions 					      shm_open(3C)

NAME
shm_open - open a shared memory object SYNOPSIS
#include <sys/mman.h> int shm_open(const char *name, int oflag, mode_t mode); DESCRIPTION
The shm_open() function establishes a connection between a shared memory object and a file descriptor. It creates an open file description that refers to the shared memory object and a file descriptor that refers to that open file description. The file descriptor is used by other functions to refer to that shared memory object. The name argument points to a string naming a shared memory object. It is unspeci- fied whether the name appears in the file system and is visible to other functions that take pathnames as arguments. The name argument con- forms to the construction rules for a pathname. The first character of name must be a slash (/) character and the remaining characters of name cannot include any slash characters. For maximum portability, name should include no more than 14 characters, but this limit is not enforced. If successful, shm_open() returns a file descriptor for the shared memory object that is the lowest numbered file descriptor not currently open for that process. The open file description is new, and therefore the file descriptor does not share it with any other processes. It is unspecified whether the file offset is set. The FD_CLOEXEC file descriptor flag associated with the new file descriptor is set. The file status flags and file access modes of the open file description are according to the value of oflag. The oflag argument is the bitwise inclusive OR of the following flags defined in the header <fcntl.h>. Applications specify exactly one of the first two values (access modes) below in the value of oflag: O_RDONLY Open for read access only. O_RDWR Open for read or write access. Any combination of the remaining flags may be specified in the value of oflag: O_CREAT If the shared memory object exists, this flag has no effect, except as noted under O_EXCL below. Otherwise the shared memory object is created; the user ID of the shared memory object will be set to the effective user ID of the process; the group ID of the shared memory object will be set to a system default group ID or to the effective group ID of the process. The permission bits of the shared memory object will be set to the value of the mode argument except those set in the file mode creation mask of the process. When bits in mode other than the file permission bits are set, the effect is unspecified. The mode argument does not affect whether the shared memory object is opened for reading, for writing, or for both. The shared memory object has a size of zero. O_EXCL If O_EXCL and O_CREAT are set, shm_open() fails if the shared memory object exists. The check for the existence of the shared memory object and the creation of the object if it does not exist is atomic with respect to other processes executing shm_open() naming the same shared memory object with O_EXCL and O_CREAT set. If O_EXCL is set and O_CREAT is not set, the result is undefined. O_TRUNC If the shared memory object exists, and it is successfully opened O_RDWR, the object will be truncated to zero length and the mode and owner will be unchanged by this function call. The result of using O_TRUNC with O_RDONLY is undefined. When a shared memory object is created, the state of the shared memory object, including all data associated with the shared memory object, persists until the shared memory object is unlinked and all other references are gone. It is unspecified whether the name and shared memory object state remain valid after a system reboot. RETURN VALUES
Upon successful completion, the shm_open() function returns a non-negative integer representing the lowest numbered unused file descriptor. Otherwise, it returns -1 and sets errno to indicate the error condition. ERRORS
The shm_open() function will fail if: EACCES The shared memory object exists and the permissions specified by oflag are denied, or the shared memory object does not exist and permission to create the shared memory object is denied, or O_TRUNC is specified and write permission is denied. EEXIST O_CREAT and O_EXCL are set and the named shared memory object already exists. EINTR The shm_open() operation was interrupted by a signal. EINVAL The shm_open() operation is not supported for the given name. EMFILE Too many file descriptors are currently in use by this process. ENAMETOOLONG The length of the name string exceeds PATH_MAX, or a pathname component is longer than NAME_MAX while _POSIX_NO_TRUNC is in effect. ENFILE Too many shared memory objects are currently open in the system. ENOENT O_CREAT is not set and the named shared memory object does not exist. ENOSPC There is insufficient space for the creation of the new shared memory object. ENOSYS The shm_open() function is not supported by the system. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ |ATTRIBUTE TYPE |ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
close(2), dup(2), exec(2), fcntl(2), mmap(2), umask(2), shm_unlink(3C), sysconf(3C), fcntl.h(3HEAD), attributes(5), standards(5) NOTES
Solaris 2.6 was the first release to support the Asynchronous Input and Output option. Prior to this release, this function always returned -1 and set errno to ENOSYS. SunOS 5.11 5 Feb 2008 shm_open(3C)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy