Fix abnormal symbol parsing when __irqentry_text_end is before __irqentry_text_start
authorEdward Wu <edwardwu@realtek.com>
Fri, 5 Mar 2021 06:13:30 +0000 (14:13 +0800)
committeryonghong-song <ys114321@gmail.com>
Fri, 5 Mar 2021 23:01:34 +0000 (15:01 -0800)
On my ARM64 kernel 5.4 case

Symbol:
ffffffc0100820b8 T __irqentry_text_end
ffffffc0100820b8 T __irqentry_text_start

It will ignore all functions after __irqentry_text_start until __irqentry_text_end.
But this case __irqentry_text_end is before __irqentry_text_start.
So the problem happens.

Signed-off-by: Edward Wu <edwardwu@realtek.com>
src/python/bcc/__init__.py

index 1375c2a41747d7790eea262e035e21636b021c0c..90562cd77adacc77166437d256d044621ee1324c 100644 (file)
@@ -587,6 +587,12 @@ class BPF(object):
                     if fn == b'__irqentry_text_start':
                         in_irq_section = 1
                         continue
+                    # __irqentry_text_end is not always after
+                    # __irqentry_text_start. But only happens when
+                    # no functions between two irqentry_text
+                    elif fn == b'__irqentry_text_end':
+                        in_irq_section = 2
+                        continue
                 elif in_irq_section == 1:
                     if fn == b'__irqentry_text_end':
                         in_irq_section = 2