Andes Workshop

A method to measure Stack Size in AndeSight
Page 1 of 1

Author:  HuJin [ Mon Feb 02, 2015 9:49 am ]
Post subject:  A method to measure Stack Size in AndeSight

This article shares a method to measure stack size in AndeSight, the core idea is that we fill the stack region with specific value 0xff after loading the elf file to target,then check the stack region after running to the end. OK we take the hello-world project as the example to show how to implement this idea.

Step1: Check the initial stack top. In normal project, we get the stack initial value from the sag file or linker script.In this demo we get the value from the sag file:
stack_init.png [ 4.6 KiB | Viewed 11597 times ]

Step2: Set the breakpoint as the early beginning (AndeSight will take main() function as the default breakpoint, keep the default setting is OK for measuring stack size, but change breakpoint to _start can show the stack consumption more clearly):
debugsetting.png [ 39.61 KiB | Viewed 11602 times ]

Step3: Debug the hello-world project, open Memory View and set a appropriate monitor.(In hello -world the SP = 0x750000, and it's a small project so we watch memory after 0x74ff00 )
memory.png [ 32.69 KiB | Viewed 11602 times ]

Step4: Fill the memory with specific value 0xff. AndeSight gets a "import" bar to do this, it's like gdb command "restore". It can import three kinds format, we suggest use "Plain Text". As:
import.png [ 46.28 KiB | Viewed 11602 times ]

Step5: Continue to run (to the last line of the project). Then check the stack region:
memoryview.png [ 18.14 KiB | Viewed 11597 times ]

We can get the used stack size is:0x750000 - 0x74ffb0 = 0x50 Byte.

The import plain text file can find here:
test.txt [1.22 KiB]
Downloaded 690 times

Author:  RichardWek [ Fri Dec 02, 2016 10:48 am ]
Post subject:  dixxrfo


viagra sin receta
cialis precio
cialis 20
levitra sin receta
super kamagra

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group