|
From: Wuweijia <wuw...@hu...> - 2017-05-12 03:11:58
Attachments:
my.rar
|
Hi :
I ran the code through the callgrind on the x86-64, it is ok , no recursive cycle existed.
But I ran the same the same code through the callgrind on the arm64, it show me there is recursive cycle existed.
Between two callgrind.out. file:
In arm64:
There is function name main'2. It meaning that there is recursive cycle. And it annote the source failed.
In x86_64:
There is no function name main'2 only main., It mean that there is no cycle.
How can I resovle it?
The compile options : gcc -g -O0 ./main.cpp
The gcc version 4.9
Run options: valgrind --tool=callgrind ./a.out
Callgrind_annote option callgrind_annote -auto=yes
BR
Owen
|
|
From: John R. <jr...@bi...> - 2017-05-12 03:37:48
|
> In arm64: > > There is function name main’2. It meaning that there is recursive cycle. And it annote the source failed. > > In x86_64: > > There is no function name main’2 only main., It mean that there is no cycle. > > How can I resolve it? Post here the source code to the smallest (shortest) program which does not behave like you expect. |
|
From: Wuweijia <wuw...@hu...> - 2017-05-12 03:47:25
Attachments:
main.cpp
|
The source code(main.cpp) is in the my.rar. and the callgrind output are also in the my.rar. Did you never receive it ? -----邮件原件----- 发件人: John Reiser [mailto:jr...@bi...] 发送时间: 2017年5月12日 11:18 收件人: val...@li... 主题: Re: [Valgrind-users] hello there is a question about callgrind on the arm64. > In arm64: > > There is function name main’2. It meaning that there is recursive cycle. And it annote the source failed. > > In x86_64: > > There is no function name main’2 only main., It mean that there is no cycle. > > How can I resolve it? Post here the source code to the smallest (shortest) program which does not behave like you expect. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Valgrind-users mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-users |
|
From: Wuweijia <wuw...@hu...> - 2017-05-12 04:40:00
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char getCommon(char * argv) {
char result = 0;
result = argv[0];
for(int i = 0; i < 2; i++ ) {
if( argv[1] > 100 ) {
result += argv[1] + 10;
}
if( argv[2] < 30 ) {
result += argv[2] * 2;
}
}
return result;
}
char getCommon2(char * argv) {
char result = 0;
result = argv[0];
for(int i = 0; i < 2; i++ ) {
if( argv[1] > 20 ) {
result += argv[1] + 10;
}
if( argv[2] < 110 ) {
result += argv[2] * 3;
}
}
return result;
}
int main(int argc, char ** argv) {
unsigned long i = 0;
char * p = (char *)malloc(1024 * 1024);
memset(p, 1, 1024 * 1024);
for(int i = 0; i < 10; i++ ) {
for(int j = 0; j < 1024 * 1024 - 3; j++) {
if(j % 2 == 0) {
p[j] = getCommon(p + j);
} else {
p[j] = getCommon2(p + j);
}
}
memset(p, 1, 1024 * 1024);
}
printf("p=%p\n", p);
return 0;
}
-----邮件原件-----
发件人: John Reiser [mailto:jr...@bi...]
发送时间: 2017年5月12日 11:18
收件人: val...@li...
主题: Re: [Valgrind-users] hello there is a question about callgrind on the arm64.
> In arm64:
>
> There is function name main’2. It meaning that there is recursive cycle. And it annote the source failed.
>
> In x86_64:
>
> There is no function name main’2 only main., It mean that there is no cycle.
>
> How can I resolve it?
Post here the source code to the smallest (shortest) program which does not behave like you expect.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Valgrind-users mailing list
Val...@li...
https://lists.sourceforge.net/lists/listinfo/valgrind-users
|
|
From: Wuweijia <wuw...@hu...> - 2017-05-16 00:17:07
|
Hi:
Is there any news?
BR
Owen
-----邮件原件-----
发件人: Wuweijia
发送时间: 2017年5月12日 12:40
收件人: 'John Reiser' <jr...@bi...>; val...@li...
抄送: Fanbohao <fan...@hu...>
主题: 答复: [Valgrind-users] hello there is a question about callgrind on the arm64.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char getCommon(char * argv) {
char result = 0;
result = argv[0];
for(int i = 0; i < 2; i++ ) {
if( argv[1] > 100 ) {
result += argv[1] + 10;
}
if( argv[2] < 30 ) {
result += argv[2] * 2;
}
}
return result;
}
char getCommon2(char * argv) {
char result = 0;
result = argv[0];
for(int i = 0; i < 2; i++ ) {
if( argv[1] > 20 ) {
result += argv[1] + 10;
}
if( argv[2] < 110 ) {
result += argv[2] * 3;
}
}
return result;
}
int main(int argc, char ** argv) {
unsigned long i = 0;
char * p = (char *)malloc(1024 * 1024);
memset(p, 1, 1024 * 1024);
for(int i = 0; i < 10; i++ ) {
for(int j = 0; j < 1024 * 1024 - 3; j++) {
if(j % 2 == 0) {
p[j] = getCommon(p + j);
} else {
p[j] = getCommon2(p + j);
}
}
memset(p, 1, 1024 * 1024);
}
printf("p=%p\n", p);
return 0;
}
-----邮件原件-----
发件人: John Reiser [mailto:jr...@bi...]
发送时间: 2017年5月12日 11:18
收件人: val...@li...
主题: Re: [Valgrind-users] hello there is a question about callgrind on the arm64.
> In arm64:
>
> There is function name main’2. It meaning that there is recursive cycle. And it annote the source failed.
>
> In x86_64:
>
> There is no function name main’2 only main., It mean that there is no cycle.
>
> How can I resolve it?
Post here the source code to the smallest (shortest) program which does not behave like you expect.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Valgrind-users mailing list
Val...@li...
https://lists.sourceforge.net/lists/listinfo/valgrind-users
|
|
From: John R. <jr...@bi...> - 2017-05-16 03:49:30
Attachments:
callgrind_annotate.out
|
> Is there any news?
I ran the program in 64-bit mode on Raspberry Pi 3 (1GiB RAM) with:
kernel-4.9.28-1 (Fedora 25)
gcc-6.3.1
glibc-2.24-4.fc25.aarch64
valgrind-3.12.0 (compiled from .tar.bz2 in one-half hour)
A swap file of 2GiB was not enough:
=====
==22295== Valgrind's memory management: out of memory:
==22295== newSuperblock's request for 1835012096 bytes failed.
==22295== 1,247,584,256 bytes have already been mmap-ed ANONYMOUS.
==22295== Valgrind cannot continue. Sorry.
=====
A swap file of 4GiB allowed execution to finish:
# dd if=/dev/zero of=/swap-file bs=1M count=4096
# chmod 600 /swap-file
# swapon /swap-file
[Side comment: Requiring more than 3GiB (1GiB RAM plus 2GiB swapspace)
for this small, short program is wildly extravagant by callgrind.]
The execution (several minutes) was:
gcc -g -O0 ./main.cpp
valgrind --tool=callgrind ./a.out
callgrind_annotate --auto=yes callgrind.out.PID main.cpp
The complete output from callgrind_annotate is attached (callgrind_annotate.out,
4.5 kB). I see lines such as
=====
10,485,720 char getCommon2(char * argv) {
5,242,860 char result = 0;
15,728,580 result = argv[0];
94,371,480 for(int i = 0; i < 2; i++ ) {
34 => ./main.cpp:getCommon2(char*)'2 (1x)
52,428,600 if( argv[1] > 20 ) {
=====
This suggests to me that callgrind's code which discovers tracebacks
has a problem, because there is no subroutine call anywhere in getCommon2,
yet callgrind thinks that getCommon2 called itself [recursively].
I have not looked carefully at what is happening.
--
|
|
From: Josef W. <Jos...@gm...> - 2017-05-19 22:24:11
|
Hi Owen, callgrind currently is somewhat broken on ARM, as the tracking of entering/leaving functions is unreliable. Callgrind heavily uses the stack pointer for that. On x86, this works fine, as every call/return changes the SP, but on ARM, this is not the case. There are ideas and at some point, there were patches promised by someone, but unfortunately nothing useful up to now... Josef Am 12.05.2017 um 05:11 schrieb Wuweijia: > Hi : > > I ran the code through the callgrind on the x86-64, it is ok , no > recursive cycle existed. > > But I ran the same the same code through the callgrind on the arm64, it > show me there is recursive cycle existed. > > Between two callgrind.out. file: > > In arm64: > > There is function name main’2. It meaning that there is > recursive cycle. And it annote the source failed. > > In x86_64: > > There is no function name main’2 only main., It mean that there > is no cycle. > > How can I resovle it? > > The compile options : gcc –g –O0 ./main.cpp > > The gcc version 4.9 > > Run options: valgrind --tool=callgrind ./a.out > > Callgrind_annote option callgrind_annote –auto=yes > > BR > > Owen > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: Wuweijia <wuw...@hu...> - 2017-06-05 08:41:17
|
Josef: Hello, is there any news now. when do you can release the patches. Owen -----邮件原件----- 发件人: Josef Weidendorfer [mailto:Jos...@gm...] 发送时间: 2017年5月20日 6:24 收件人: val...@li... 主题: Re: [Valgrind-users] hello there is a question about callgrind on the arm64. Hi Owen, callgrind currently is somewhat broken on ARM, as the tracking of entering/leaving functions is unreliable. Callgrind heavily uses the stack pointer for that. On x86, this works fine, as every call/return changes the SP, but on ARM, this is not the case. There are ideas and at some point, there were patches promised by someone, but unfortunately nothing useful up to now... Josef Am 12.05.2017 um 05:11 schrieb Wuweijia: > Hi : > > I ran the code through the callgrind on the x86-64, it is ok , no > recursive cycle existed. > > But I ran the same the same code through the callgrind on the arm64, > it show me there is recursive cycle existed. > > Between two callgrind.out. file: > > In arm64: > > There is function name main’2. It meaning that there is > recursive cycle. And it annote the source failed. > > In x86_64: > > There is no function name main’2 only main., It mean that > there is no cycle. > > How can I resovle it? > > The compile options : gcc g O0 ./main.cpp > > The gcc version 4.9 > > Run options: valgrind --tool=callgrind ./a.out > > Callgrind_annote option callgrind_annote auto=yes > > BR > > Owen > > > > ---------------------------------------------------------------------- > -------- Check out the vibrant tech community on one of the world's > most engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Valgrind-users mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-users |
|
From: Josef W. <Jos...@gm...> - 2017-06-09 17:04:27
|
Sorry, no progress on this front. If you have any ideas to correctly synchronize real/shadow stack in callgrind and can do some tests, this would be very welcome! Josef Am 05.06.2017 um 10:40 schrieb Wuweijia: > Josef: > Hello, is there any news now. when do you can release the patches. > > Owen > > > -----邮件原件----- > 发件人: Josef Weidendorfer [mailto:Jos...@gm...] > 发送时间: 2017年5月20日 6:24 > 收件人: val...@li... > 主题: Re: [Valgrind-users] hello there is a question about callgrind on the arm64. > > Hi Owen, > > callgrind currently is somewhat broken on ARM, as the tracking of entering/leaving functions is unreliable. > > Callgrind heavily uses the stack pointer for that. > On x86, this works fine, as every call/return changes the SP, but on ARM, this is not the case. > > There are ideas and at some point, there were patches promised by someone, but unfortunately nothing useful up to now... > > Josef > > > Am 12.05.2017 um 05:11 schrieb Wuweijia: >> Hi : >> >> I ran the code through the callgrind on the x86-64, it is ok , no >> recursive cycle existed. >> >> But I ran the same the same code through the callgrind on the arm64, >> it show me there is recursive cycle existed. >> >> Between two callgrind.out. file: >> >> In arm64: >> >> There is function name main’2. It meaning that there is >> recursive cycle. And it annote the source failed. >> >> In x86_64: >> >> There is no function name main’2 only main., It mean that >> there is no cycle. >> >> How can I resovle it? >> >> The compile options : gcc –g –O0 ./main.cpp >> >> The gcc version 4.9 >> >> Run options: valgrind --tool=callgrind ./a.out >> >> Callgrind_annote option callgrind_annote –auto=yes >> >> BR >> >> Owen >> >> >> >> ---------------------------------------------------------------------- >> -------- Check out the vibrant tech community on one of the world's >> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> >> >> _______________________________________________ >> Valgrind-users mailing list >> Val...@li... >> https://lists.sourceforge.net/lists/listinfo/valgrind-users >> > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |
|
From: Wuweijia <wuw...@hu...> - 2017-06-12 03:27:43
|
I do not know what the shadow stack meant. Is there any idea for the option of compilation to correct it, and I can handle it quickly not modify your codes . Owen -----邮件原件----- 发件人: Josef Weidendorfer [mailto:Jos...@gm...] 发送时间: 2017年6月10日 1:04 收件人: Wuweijia <wuw...@hu...>; val...@li... 抄送: Fanbohao <fan...@hu...> 主题: Re: 答复: [Valgrind-users] hello there is a question about callgrind on the arm64. Sorry, no progress on this front. If you have any ideas to correctly synchronize real/shadow stack in callgrind and can do some tests, this would be very welcome! Josef Am 05.06.2017 um 10:40 schrieb Wuweijia: > Josef: > Hello, is there any news now. when do you can release the patches. > > Owen > > > -----邮件原件----- > 发件人: Josef Weidendorfer [mailto:Jos...@gm...] > 发送时间: 2017年5月20日 6:24 > 收件人: val...@li... > 主题: Re: [Valgrind-users] hello there is a question about callgrind on the arm64. > > Hi Owen, > > callgrind currently is somewhat broken on ARM, as the tracking of entering/leaving functions is unreliable. > > Callgrind heavily uses the stack pointer for that. > On x86, this works fine, as every call/return changes the SP, but on ARM, this is not the case. > > There are ideas and at some point, there were patches promised by someone, but unfortunately nothing useful up to now... > > Josef > > > Am 12.05.2017 um 05:11 schrieb Wuweijia: >> Hi : >> >> I ran the code through the callgrind on the x86-64, it is ok , no >> recursive cycle existed. >> >> But I ran the same the same code through the callgrind on the arm64, >> it show me there is recursive cycle existed. >> >> Between two callgrind.out. file: >> >> In arm64: >> >> There is function name main’2. It meaning that there is >> recursive cycle. And it annote the source failed. >> >> In x86_64: >> >> There is no function name main’2 only main., It mean that >> there is no cycle. >> >> How can I resovle it? >> >> The compile options : gcc g O0 ./main.cpp >> >> The gcc version 4.9 >> >> Run options: valgrind --tool=callgrind ./a.out >> >> Callgrind_annote option callgrind_annote auto=yes >> >> BR >> >> Owen >> >> >> >> --------------------------------------------------------------------- >> - >> -------- Check out the vibrant tech community on one of the world's >> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> >> >> _______________________________________________ >> Valgrind-users mailing list >> Val...@li... >> https://lists.sourceforge.net/lists/listinfo/valgrind-users >> > > > ---------------------------------------------------------------------- > -------- Check out the vibrant tech community on one of the world's > most engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Valgrind-users mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |