Bug 410034 - CDT debugger translates long arrays to wrong memory addresses
Summary: CDT debugger translates long arrays to wrong memory addresses
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug (show other bugs)
Version: 8.1.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-debug-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-06 04:16 EDT by Szõts Ákos CLA
Modified: 2020-09-04 15:24 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Szõts Ákos CLA 2013-06-06 04:16:21 EDT
1.) Create this simple program:
#include <cstdio>

int main() {
    double *data = new double[9990];
    for (int i = 0; i < 9990; ++i)
        data[i] = 20;

    printf("0:    %p\n", (void*) &data[0]);
    printf("9990: %p\n", (void*) &data[9990]);

    return 0;
}

/* 
 * Output for me:
 * 0:    0x602010
 * 9990: 0x615840
 */


2.) Compile it and run in the debugger. Set a breakpoint before "return 0".
3.) In the Debug view, Variables tab, right click on the "data" row and select "Display as Array" with length 9990.
4.) Observe the first 4999 variables randomly. They hold the correct values (20).
5.) Now open the the "[5000...5099]" row and see that from now on those either contain zeroes or memory junk.
6.) Right click on the 5000th row and select "View memory". As you can see in the Address column, the memory address is greater than the printf showed for data[9990].

System properties:
- openSUSE 12.3 x64 (with kernel 3.9.2)
- Eclipse Platform v4.2.1
- CDT 8.1.2
- CDT GDB Common 7.0.0
- GNU gdb (GDB) SUSE (7.5.1-2.1.1)
- gcc (SUSE Linux) 4.7.2 20130108 [gcc-4_7-branch revision 195012]