diff options
author | Che-yu Wu <cheyuw@google.com> | 2017-08-16 12:25:43 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-16 02:06:00 -0700 |
commit | 79e3b1c5e29e45eb25a8b7ad8f0b1679d31776df (patch) | |
tree | 0616f99371cf40cacfacef6a0ad7d6dc05df2f28 /extra/stack_analyzer/stack_analyzer.py | |
parent | 1a4bb89af29c684adba21f87dce4725a440e0cc3 (diff) | |
download | chrome-ec-79e3b1c5e29e45eb25a8b7ad8f0b1679d31776df.tar.gz |
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>
Diffstat (limited to 'extra/stack_analyzer/stack_analyzer.py')
-rwxr-xr-x | extra/stack_analyzer/stack_analyzer.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/extra/stack_analyzer/stack_analyzer.py b/extra/stack_analyzer/stack_analyzer.py index df7b7c8932..cc9543cc8c 100755 --- a/extra/stack_analyzer/stack_analyzer.py +++ b/extra/stack_analyzer/stack_analyzer.py @@ -76,6 +76,9 @@ class Task(object): Returns: True if equal, False if not. """ + if not isinstance(other, Task): + return False + return (self.name == other.name and self.routine_name == other.routine_name and self.stack_max_size == other.stack_max_size and @@ -116,6 +119,9 @@ class Symbol(object): Returns: True if equal, False if not. """ + if not isinstance(other, Symbol): + return False + return (self.address == other.address and self.symtype == other.symtype and self.size == other.size and @@ -156,6 +162,9 @@ class Callsite(object): Returns: True if equal, False if not. """ + if not isinstance(other, Callsite): + return False + if not (self.address == other.address and self.target == other.target and self.is_tail == other.is_tail): @@ -217,6 +226,9 @@ class Function(object): Returns: True if equal, False if not. """ + if not isinstance(other, Function): + return False + # TODO(cheyuw): Don't compare SCC node attributes here. if not (self.address == other.address and self.name == other.name and |