[Crash-utility] [Crash-Utility][PATCH v2 12/13] x86_64: Fix invalid input "=>" for bt command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There may be extra "=>" prefix before gdb disassembly, as a result,
parse_line() will return string "=>" as arglist[0], which will be
converted to number by htol() and fails. E.g.:

crash> gdb x/40i __list_del_entry
   ...
   0xffffffff8133c384 <__list_del_entry+36>:    cmp    %rcx,%rax
   0xffffffff8133c387 <__list_del_entry+39>:    je     0xffffffff8133c403 <__list_del_entry+163>
=> 0xffffffff8133c389 <__list_del_entry+41>:    mov    (%rax),%r8
   0xffffffff8133c38c <__list_del_entry+44>:    cmp    %r8,%rdi
   0xffffffff8133c38f <__list_del_entry+47>:    jne    0xffffffff8133c3e4 <__list_del_entry+132>
   0xffffffff8133c391 <__list_del_entry+49>:    mov    0x8(%rdx),%r8

Before the patch:

crash> bt
 ...
 #10 [ffff880095647c00] async_page_fault at ffffffff816a8638
    [exception RIP: __list_del_entry+41]
    RIP: ffffffff8133c389  RSP: ffff880095647cb0  RFLAGS: 00010207
    RAX: 0000000000000000  RBX: ffffea0400408020  RCX: dead000000000200
    RDX: 0000000000000000  RSI: 0000000000000246  RDI: ffffea0400408020
    RBP: ffff880095647cb0   R8: 0000000080000431   R9: ffffffff81e835c0
    R10: 0000000000000000  R11: 0000000000000400  R12: ffff880138795b58
    R13: 0000000010010201  R14: ffff880095647d70  R15: 0000000400408040
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 bt: invalid input: "=>"
 #11 [ffff880095647cb8] list_del at ffffffff8133c43d
 #12 [ffff880095647cd0] devm_memremap_pages at ffffffff81180c53

After the patch:

No string as 'bt: invalid input: "=>"' of output.

Signed-off-by: Tao Liu <ltao@xxxxxxxxxx>
---
 x86_64.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/x86_64.c b/x86_64.c
index 54c69fd..47c215f 100644
--- a/x86_64.c
+++ b/x86_64.c
@@ -8829,6 +8829,8 @@ x86_64_get_framesize(struct bt_info *bt, ulong textaddr, ulong rsp, char *stack_
 
         rewind(pc->tmpfile2);
         while (fgets(buf, BUFSIZE, pc->tmpfile2)) {
+		if (STRNEQ(buf, "=>"))
+			shift_string_left(buf, 2);
 		strcpy(buf2, buf);
 
 		if (CRASHDEBUG(3))
-- 
2.40.1
--
Crash-utility mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxxxxxx
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux