Bug 578201 - Sometimes variables show as "N/A - Cannot read target memory. Input/output error"
Summary: Sometimes variables show as "N/A - Cannot read target memory. Input/output er...
Status: RESOLVED FIXED
Alias: None
Product: TCF
Classification: Tools
Component: Agent (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Eugene Tarassov CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-13 08:16 EST by Nobody - feel free to take it CLA
Modified: 2022-01-17 14:22 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2022-01-13 08:16:09 EST
When using the TCF agent compiled with the latest commit from master on Linux, the address of some variables is evaluated to an address that cannot be read. The issue can be reproduced with the following example C code:

int times_2(int * num){
	return (*num)*2;
}

int main()
{
   while(1){
        int i_1 = 2;
        int i_2 = 3;
        int i_3 = 4;
        volatile unsigned int a[3] = {times_2(&i_1), times_2(&i_2), times_2(&i_3)};
        volatile int b = 0;
   }
   return 0;
}

The variables inside the while loop show as "N/A - Cannot read target memory. Input/output error". The addresses of the variables are calculated as follows:

i_1 Address: 0xffffffffffffffc0
i_2 Address: 0xffffffffffffffc4
i_3 Address: 0xffffffffffffffc8
a Address: 0xffffffffffffffd0
b Address: 0xffffffffffffffcc

While evaluating expressions like "&a[0]" or "&b", the resulting address is the same. On a separate note, the stack shows only one frame.

The issue seemed to show up after merging the commit https://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git/commit/?id=4443aa3df7df5591274b25c7c1868b7a9574be9a . When building the agent with that commit, the addresses and variables are calculated correctly in both the Variables and the Expressions views. The stack shows three frames.

The example C code was compiled with the following command: gcc my_app.c -g -Og -o my_app.
Comment 1 Eugene Tarassov CLA 2022-01-17 14:22:32 EST
It is caused by regression in stack trace.
Fixed.
Thanks!