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(3)						     Linux Programmer's Manual						       SHM_OPEN(3)

NAME
shm_open, shm_unlink - create/open or unlink POSIX shared memory objects SYNOPSIS
#include <sys/mman.h> #include <sys/stat.h> /* For mode constants */ #include <fcntl.h> /* For O_* constants */ int shm_open(const char *name, int oflag, mode_t mode); int shm_unlink(const char *name); Link with -lrt. DESCRIPTION
shm_open() creates and opens a new, or opens an existing, POSIX shared memory object. A POSIX shared memory object is in effect a handle which can be used by unrelated processes to mmap(2) the same region of shared memory. The shm_unlink() function performs the converse operation, removing an object previously created by shm_open(). The operation of shm_open() is analogous to that of open(2). name specifies the shared memory object to be created or opened. For porta- ble use, a shared memory object should be identified by a name of the form /somename; that is, a null-terminated string of up to NAME_MAX (i.e., 255) characters consisting of an initial slash, followed by one or more characters, none of which are slashes. oflag is a bit mask created by ORing together exactly one of O_RDONLY or O_RDWR and any of the other flags listed here: O_RDONLY Open the object for read access. A shared memory object opened in this way can only be mmap(2)ed for read (PROT_READ) access. O_RDWR Open the object for read-write access. O_CREAT Create the shared memory object if it does not exist. The user and group ownership of the object are taken from the correspond- ing effective IDs of the calling process, and the object's permission bits are set according to the low-order 9 bits of mode, except that those bits set in the process file mode creation mask (see umask(2)) are cleared for the new object. A set of macro constants which can be used to define mode is listed in open(2). (Symbolic definitions of these constants can be obtained by including <sys/stat.h>.) A new shared memory object initially has zero length--the size of the object can be set using ftruncate(2). The newly allocated bytes of a shared memory object are automatically initialized to 0. O_EXCL If O_CREAT was also specified, and a shared memory object with the given name already exists, return an error. The check for the existence of the object, and its creation if it does not exist, are performed atomically. O_TRUNC If the shared memory object already exists, truncate it to zero bytes. Definitions of these flag values can be obtained by including <fcntl.h>. On successful completion shm_open() returns a new file descriptor referring to the shared memory object. This file descriptor is guaran- teed to be the lowest-numbered file descriptor not previously opened within the process. The FD_CLOEXEC flag (see fcntl(2)) is set for the file descriptor. The file descriptor is normally used in subsequent calls to ftruncate(2) (for a newly created object) and mmap(2). After a call to mmap(2) the file descriptor may be closed without affecting the memory mapping. The operation of shm_unlink() is analogous to unlink(2): it removes a shared memory object name, and, once all processes have unmapped the object, de-allocates and destroys the contents of the associated memory region. After a successful shm_unlink(), attempts to shm_open() an object with the same name will fail (unless O_CREAT was specified, in which case a new, distinct object is created). RETURN VALUE
On success, shm_open() returns a nonnegative file descriptor. On failure, shm_open() returns -1. shm_unlink() returns 0 on success, or -1 on error. ERRORS
On failure, errno is set to indicate the cause of the error. Values which may appear in errno include the following: EACCES Permission to shm_unlink() the shared memory object was denied. EACCES Permission was denied to shm_open() name in the specified mode, or O_TRUNC was specified and the caller does not have write permis- sion on the object. EEXIST Both O_CREAT and O_EXCL were specified to shm_open() and the shared memory object specified by name already exists. EINVAL The name argument to shm_open() was invalid. EMFILE The process already has the maximum number of files open. ENAMETOOLONG The length of name exceeds PATH_MAX. ENFILE The limit on the total number of files open on the system has been reached. ENOENT An attempt was made to shm_open() a name that did not exist, and O_CREAT was not specified. ENOENT An attempt was to made to shm_unlink() a name that does not exist. VERSIONS
These functions are provided in glibc 2.2 and later. CONFORMING TO
POSIX.1-2001. POSIX.1-2001 says that the group ownership of a newly created shared memory object is set to either the calling process's effective group ID or "a system default group ID". NOTES
POSIX leaves the behavior of the combination of O_RDONLY and O_TRUNC unspecified. On Linux, this will successfully truncate an existing shared memory object--this may not be so on other UNIX systems. The POSIX shared memory object implementation on Linux 2.4 makes use of a dedicated file system, which is normally mounted under /dev/shm. SEE ALSO
close(2), fchmod(2), fchown(2), fcntl(2), fstat(2), ftruncate(2), mmap(2), open(2), umask(2), shm_overview(7) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-02-25 SHM_OPEN(3)
All times are GMT -4. The time now is 10:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy