Hi Tao,
I'm sorry I forget my vmlinux is with IKCONFIG enabled, so yesterday's test did 
not cover the branch where tbnz is located.

> Thank you for the improvements to the patch.
> I have verified this patch and found no problems. After applying this patch, 
> command bt -a
> will not cause segfault issue, and the irq_stack_size in crash tools has 
> correct value.

I found that that patch not work well due to this lines:
> +                                     thread_shift = stol(pos2 + 1,
> +                                                     RETURN_ON_ERROR|QUIET,
> +                                                     &errflag);
By disable the `QUIET` flag, the crash tool output error:
  crash: not a valid number: 15, 0xffffffc00801081c <vectors+28>

I think stol() function cannot extract a single digit from char* with 
non-numeric characters, so I use sscanf() in following patch which can work 
well.

---
 arm64.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/arm64.c b/arm64.c
index 81c4eeb..26af590 100644
--- a/arm64.c
+++ b/arm64.c
@@ -5031,16 +5031,12 @@ static ulong arm64_set_irq_stack_size(void)
                while (fgets(buf1, BUFSIZE, pc->tmpfile)) {
                        if ((pos1 = strstr(buf1, "tbnz"))) {
                                if ((pos2 = strchr(pos1, '#'))) {
-                                       thread_shift = stol(pos2 + 1,
-                                                       RETURN_ON_ERROR|QUIET,
-                                                       &errflag);
-                                       if (errflag) {
-                                               thread_shift = 0;
-                                       } else if (CRASHDEBUG(1)) {
-                                               error(INFO, "Detect thread 
shift"
-                                               " via tbnz %ld\n", 
thread_shift);
+                                       if (sscanf(pos2 + 1, "%ld", 
&thread_shift) == 1) {
+                                               if (CRASHDEBUG(1)){
+                                                       error(INFO, "Detect 
thread shift via tbnz %ld\n", thread_shift);
+                                               }
+                                               break;
                                        }
-                                       break;
                                }
                        }
                }
-- 
2.25.1

Thanks,
Yeping.ZHENG
--
Crash-utility mailing list -- devel@lists.crash-utility.osci.io
To unsubscribe send an email to devel-le...@lists.crash-utility.osci.io
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to