Commit Graph

8 Commits

Author SHA1 Message Date
Che-yu Wu
af32f8918e extra/stack_analyzer: Eliminate annotated indirect calls.
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>
2017-08-29 04:45:51 -07:00
Che-yu Wu
4f21ee309c extra/stack_analyzer: Show indirect calls.
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>
2017-08-24 01:25:51 -07:00
Che-yu Wu
eeeee803b7 extra/stack_analyzer: Show callsite information.
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>
2017-08-23 23:13:38 -07:00
Che-yu Wu
00e0222729 extra/stack_analyzer: Fix cbz/cbnz and addr2line parsing.
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>
2017-08-22 05:08:48 -07:00
Che-yu Wu
ef09835e19 ec: Add annotation feature to the stack analyzer.
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>
2017-08-21 23:48:14 -07:00
Che-yu Wu
79e3b1c5e2 ec: Fix object comparison in the stack analyzer
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>
2017-08-16 02:06:00 -07:00
Che-yu Wu
64ecddfd86 ec: Add a task information library for the stack analyzer.
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>
2017-08-15 00:25:20 -07:00
Che-yu Wu
1bf7abdc20 ec: Add analysis tool for firmware stack usage.
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>
2017-08-14 05:54:35 -07:00