LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 10-20-2015, 08:16 AM   #1
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Rep: Reputation: Disabled
Cannot access memory at address?


I observed a strange behaviour from gdb. Please assist me to identify this.
Below is affected snippet.
Note: Below for loop should not execute more than two times as max value of totNumEntries is 2.
Code:
totNumEntries = callLegPtr->activeSpContextPtr->directMediaPtr->numEntries;
for (index = 0; index < totNumEntries; index++)
{
.......
}
Printing values via gdb.
Code:
(gdb) p index
$79 = 35933
(gdb) p totNumEntries
$80 = 65535
(gdb) p callLegPtr->activeSpContextPtr->directMediaPtr->numEntries
Cannot access memory at address 0x53369955
As per gdb print, 0x53369955 is out of bond and cannot be accessible but still i can see "totNumEntries" having value 65535 because of that reason above for loop went into to many iterations (35933) and our process declared time out.
Type of totNumEntries is unsigned short (Max value is 65535).

My concern is what exactly the meaning of "Cannot access memory at address 0x53369955". When 0x53369955 is not accessible how come "totNumEntries" taking large value which maximum range for unsigned int type. It is very important for me to understand, please let me know if you need any further information.

Regards,
Shahid Hussain

Last edited by Shahid nx; 10-21-2015 at 02:22 AM.
 
Old 10-20-2015, 12:09 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
You can print out the address and contents of callLegPtr, then do so for activeSpContextPtr, and once again for directMediaPtr. Something is wrong with one of those structures or pointers. 65535 is 0xFFFF, perhaps that came from somewhere if not nowhere. You can do a couple of things:
  1. Break before the assignment and check the structures in advance of the assignment
  2. Break down the assignment to steps. Make local variables to point to each of activeSpContext structure, directMedia structure, and then break before assignment and see each decode occur by stepping
  3. You may want to use -O0 to disable optimizations while you do this
 
Old 10-25-2015, 04:05 AM   #3
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 13,602

Rep: Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084Reputation: 4084
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread

Tags
c/c++, gdb, memory management



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to access UART registers which is memory mapped at address 0x2530c00 in Linux? girmaji Linux - Embedded & Single-board computer 0 01-14-2014 09:44 AM
virtual address to physical memory access pupillo Linux - General 2 02-22-2010 10:07 AM
how to access unaligned address of memory? nesta Programming 2 05-12-2007 11:22 AM
gdb : Cannot access memory at address 0x99f825d4 johnpaulodonnell Linux - Newbie 1 03-23-2007 08:14 PM
Access address out of main memory tsik Programming 3 01-17-2007 06:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration