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(2)						      BSD System Calls Manual						       SHM_OPEN(2)

NAME
shm_open, shm_unlink -- shared memory object operations LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/types.h> #include <sys/mman.h> int shm_open(const char *path, int flags, mode_t mode); int shm_unlink(const char *path); DESCRIPTION
The shm_open() system call opens (or optionally creates) a POSIX shared memory object named path. The flags argument contains a subset of the flags used by open(2). An access mode of either O_RDONLY or O_RDWR must be included in flags. The optional flags O_CREAT, O_EXCL, and O_TRUNC may also be specified. If O_CREAT is specified, then a new shared memory object named path will be created if it does not exist. In this case, the shared memory object is created with mode mode subject to the process' umask value. If both the O_CREAT and O_EXCL flags are specified and a shared memory object named path already exists, then shm_open() will fail with EEXIST. Newly created objects start off with a size of zero. If an existing shared memory object is opened with O_RDWR and the O_TRUNC flag is spec- ified, then the shared memory object will be truncated to a size of zero. The size of the object can be adjusted via ftruncate(2) and queried via fstat(2). The new descriptor is set to close during execve(2) system calls; see close(2) and fcntl(2). As a FreeBSD extension, the constant SHM_ANON may be used for the path argument to shm_open(). In this case, an anonymous, unnamed shared memory object is created. Since the object has no name, it cannot be removed via a subsequent call to shm_unlink(). Instead, the shared memory object will be garbage collected when the last reference to the shared memory object is removed. The shared memory object may be shared with other processes by sharing the file descriptor via fork(2) or sendmsg(2). Attempting to open an anonymous shared memory object with O_RDONLY will fail with EINVAL. All other flags are ignored. The shm_unlink() system call removes a shared memory object named path. RETURN VALUES
If successful, shm_open() returns a non-negative integer, and shm_unlink() returns zero. Both functions return -1 on failure, and set errno to indicate the error. COMPATIBILITY
The path argument does not necessarily represent a pathname (although it does in most other implementations). Two processes opening the same path are guaranteed to access the same shared memory object if and only if path begins with a slash ('/') character. Only the O_RDONLY, O_RDWR, O_CREAT, O_EXCL, and O_TRUNC flags may be used in portable programs. The result of using open(2), read(2), or write(2) on a shared memory object, or on the descriptor returned by shm_open(), is undefined. It is also undefined whether the shared memory object itself, or its contents, persist across reboots. In FreeBSD, read(2) and write(2) on a shared memory object will fail with EOPNOTSUPP and neither shared memory objects nor their contents persist across reboots. ERRORS
The following errors are defined for shm_open(): [EINVAL] A flag other than O_RDONLY, O_RDWR, O_CREAT, O_EXCL, or O_TRUNC was included in flags. [EMFILE] The process has already reached its limit for open file descriptors. [ENFILE] The system file table is full. [EINVAL] O_RDONLY was specified while creating an anonymous shared memory object via SHM_ANON. [EFAULT] The path argument points outside the process' allocated address space. [ENAMETOOLONG] The entire pathname exceeded 1023 characters. [EINVAL] The path does not begin with a slash ('/') character. [ENOENT] O_CREAT is specified and the named shared memory object does not exist. [EEXIST] O_CREAT and O_EXCL are specified and the named shared memory object dies exist. [EACCES] The required permissions (for reading or reading and writing) are denied. The following errors are defined for shm_unlink(): [EFAULT] The path argument points outside the process' allocated address space. [ENAMETOOLONG] The entire pathname exceeded 1023 characters. [ENOENT] The named shared memory object does not exist. [EACCES] The required permissions are denied. shm_unlink() requires write permission to the shared memory object. SEE ALSO
close(2), ftruncate(2), fstat(2), mmap(2), munmap(2) STANDARDS
The shm_open() and shm_unlink() functions are believed to conform to IEEE Std 1003.1b-1993 (``POSIX.1''). HISTORY
The shm_open() and shm_unlink() functions first appeared in FreeBSD 4.3. The functions were reimplemented as system calls using shared mem- ory objects directly rather than files in FreeBSD 7.0. AUTHORS
Garrett A. Wollman <wollman@FreeBSD.org> (C library support and this manual page) Matthew Dillon <dillon@FreeBSD.org> (MAP_NOSYNC) BSD
March 20, 2007 BSD
All times are GMT -4. The time now is 06:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy