summaryrefslogtreecommitdiff
path: root/extra/stack_analyzer
Commit message (Collapse)AuthorAgeFilesLines
* stack_analyzer_unittest: Unit test of analyze disassembly for Andes instructionstabilize-10985.Btim2018-08-201-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | Write a rough disassembly with Andes instruction in stack_analyzer_unittest.py which rough disassembly is analyzed by stack_analyzer.py to get some results. If these results are the same with expect results, the unit test will pass. In the rough disassembly, the file format is added in the second line, because the stack analyzer will be looking for the word of 'arm' or 'nds' in the line, and then get the corresponding Analyzer class. BUG=b:111746842 BRANCH=none TEST=./extra/stack_analyzer/run_tests.sh Change-Id: I3acbfb199f762a4e89ea95f6254628871a5beb5d Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1174331 Commit-Ready: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Tested-by: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stack_analyzer: EC stack analyzer for Andes instruction architecturetim2018-08-201-38/+194
| | | | | | | | | | | | | | | | | | | | | Add the related stack instructions analysis for Andes architecture to calculate stack frame sizes of functions and find the maximum calling path with maximum stack usage in stack analyzer tool. The second line in each disassembly will present this core architecture, so we can be looking for the word of 'arm' or 'nds' in the line and then get the corresponding Analyzer class. BUG=b:111746842 BRANCH=none TEST=make BOARD=${BOARD} SECTION=RO or RW analyzestack Change-Id: I8414920ddee97ce913519ef878f770e6e3118ef7 Signed-off-by: tim <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1174332 Commit-Ready: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Tested-by: Tim2 Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* stack_analyzer: Add new syntax for function pointer arraysNicolas Boichat2018-03-193-14/+187
| | | | | | | | | | | | | | Makes it far simpler to support hooks, console commands, host commands. BRANCH=poppy,fizz BUG=chromium:648840 TEST=Add new array annotation, run stack_analyzer Change-Id: I8ed074ba5534661ed59f4f713bb4ba194e712f4e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/966042 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stack_analyzer: Use board/$BOARD/analyzestack.yaml by defaultNicolas Boichat2017-09-073-23/+43
| | | | | | | | | | | | BRANCH=none BUG=chromium:648840 TEST=make BOARD=hammer analyzestack Change-Id: Id05fee7e085a02dd4c2d36880f6891c3eb86b404 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/637550 Reviewed-by: Che-yu Wu <cheyuw@google.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* extra/stack_analyzer: Configurable exception frame size.Che-yu Wu2017-09-054-8/+17
| | | | | | | | | | | | | | | | | Make the size of extra stack needed by exceptions configurable. It can be set in the annotation file. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: Idf2a59650dd20257a0291f89d788c0c83b91a7c9 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/649454 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* extra/stack_analyzer: Support function sets in invalid paths.Che-yu Wu2017-09-053-23/+76
| | | | | | | | | | | | | | | | | | | There are lots of invalid paths have common segments. In this patch, each vertex of an invalid path can be a function set. Examples can be found in extra/stack_analyzer/example_annotation.yaml BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: Ib10d68edd04725af4d803f54f7e208e55d574c7d Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/649453 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* extra/stack_analyzer: Support to remove invalid paths.stabilize-9901.77.Bstabilize-9901.54.Bstabilize-9901.53.Bstabilize-9901.35.Brelease-R62-9901.BChe-yu Wu2017-09-013-201/+468
| | | | | | | | | | | | | | | | | | | | | | | | | Invalid paths (with arbitrary length) can be annotated and removed. Report set of possible function cycles. Sort the callsite outputs by filename and line number. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ --annotation=./extra/stack_analyzer/example_annotation.yaml \ ./build/elm/RW/ec.RW.elf make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: I9d443df6439b55d5b92a7624bdd93cb6e18494e2 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/640393 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* presubmit_check: Check unittests results on extra/stack_analyzerNicolas Boichat2017-08-291-0/+9
| | | | | | | | | | | | BRANCH=none BUG=none TEST=util/presubmit_check.sh Change-Id: I6078377603719de1d633660c69ad3a40b29ffadf Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/640191 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Che-yu Wu <cheyuw@google.com>
* extra/stack_analyzer: Eliminate annotated indirect calls.Che-yu Wu2017-08-294-106/+289
| | | | | | | | | | | | | | | | | | | | | | | | Indirect calls can be eliminated by adding corresponding annotations. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ --annotation=./extra/stack_analyzer/example_annotation.yaml \ ./build/elm/RW/ec.RW.elf make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: I18c317f9c6478b5b431ee04d882453791df27891 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/631082 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* extra/stack_analyzer: Show indirect calls.Che-yu Wu2017-08-243-17/+62
| | | | | | | | | | | | | | | | | | | | | | | Show the indirect calls found in disassembly. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ --annotation=./extra/stack_analyzer/example_annotation.yaml \ ./build/elm/RW/ec.RW.elf make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: Ib82e68e0bc6c4be56ab679c297f256cbfe94bbb7 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/628048 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* extra/stack_analyzer: Show callsite information.Che-yu Wu2017-08-233-50/+164
| | | | | | | | | | | | | | | | | | | | | | | | Show callsite details in the call trace. Handle another addr2line failure output. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ --annotation=./extra/stack_analyzer/example_annotation.yaml \ ./build/elm/RW/ec.RW.elf make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: I3f36584af85f578f1d298bcd06622ba8e7e5262d Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/628000 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* extra/stack_analyzer: Fix cbz/cbnz and addr2line parsing.Che-yu Wu2017-08-222-38/+50
| | | | | | | | | | | | | | Fix the cbz/cbnz operands parsing. Parse the discriminator output of addr2line. BUG=none BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py Change-Id: Iade1c14db0dc63fa65ef0f5df778b4f4f1e4f802 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/625498 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* ec: Add annotation feature to the stack analyzer.Che-yu Wu2017-08-214-27/+412
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get stack analyzer supported to read annotation file and do basic annotation on the callgraph. The basic annotation includes: 1. Add missing calls to the callgraph 2. Ignore functions on the callgraph BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ --annotation=./extra/stack_analyzer/example_annotation.yaml \ ./build/elm/RW/ec.RW.elf make BOARD=elm SECTION=RW \ ANNOTATION=./extra/stack_analyzer/example_annotation.yaml \ analyzestack Change-Id: I4cc7c34f422655708a7312db3f6b4416e1af917f Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/614825 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Fix object comparison in the stack analyzerChe-yu Wu2017-08-162-0/+44
| | | | | | | | | | | | | Handle the case of comparing with different kinds of objects. BUG=none BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py Change-Id: I01056cd39e14d75442d4029b6c64d9843c49cf2a Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/616367 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* ec: Add a task information library for the stack analyzer.Che-yu Wu2017-08-152-48/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a shared library to export task information. Modified the stack analyzer to get information from the shared library. Show allocated stack sizes of tasks in the stack analyzer. To get the all task information (including the allocated stack size), A shared library is added and compiled with the board to export all configurations of the tasklist. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ --export_taskinfo=./build/elm/util/export_taskinfo.so \ --section=RW \ ./build/elm/RW/ec.RW.elf make BOARD=${BOARD} SECTION=${SECTION} analyzestack Change-Id: I72f01424142bb0a99c6776a55735557308e2cab6 Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/611693 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* ec: Add analysis tool for firmware stack usage.Che-yu Wu2017-08-143-0/+1117
Add a static analysis tool for firmware stack usage. Add an new Makefile rule to analyze the stack usages of firmwares. Details about the tool can be found in extra/stack_analyzer/README.md. BUG=chromium:648840 BRANCH=none TEST=extra/stack_analyzer/stack_analyzer_unittest.py make BOARD=elm && make BOARD=elm build/elm/RW/ec.RW.taskinfo && \ extra/stack_analyzer/stack_analyzer.py \ --objdump=arm-none-eabi-objdump \ --addr2line=arm-none-eabi-addr2line \ ./build/elm/RW/ec.RW.elf ./build/elm/RW/ec.RW.taskinfo make BOARD=${BOARD} SECTION=${SECTION} analyzestack Change-Id: Ifb1b5f5ad6be8f8b125b14d6ee03e25cb385895b Signed-off-by: Che-yu Wu <cheyuw@google.com> Reviewed-on: https://chromium-review.googlesource.com/576411 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>