crash icon indicating copy to clipboard operation
crash copied to clipboard

dis -s command show wrong line number and source code

Open yangliping opened this issue 3 years ago • 2 comments

crash version: 7.3.0 gdb version: 7.6.1-94.el7 os version: CentOS Linux release 7.3.1611 (Core) kernel version: 3.10.0-957.el7_lustre.x86_64

The source code for the module installed and the debuginfo installed is slightly different. It's not from the same build. And I can use gdb to show the source code correctly.

# gdb -q /usr/lib/debug/usr/lib/modules/3.10.0-957.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko.debug
Reading symbols from /usr/lib/debug/usr/lib/modules/3.10.0-957.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko.debug...done.
(gdb) list *(ptlrpc_wait_event)
0x5f420 is in ptlrpc_wait_event (/usr/src/debug/lustre-2.10.6/lustre/ptlrpc/service.c:2412).
2407    }
2408
2409    static __attribute__((__noinline__)) int
2410    ptlrpc_wait_event(struct ptlrpc_service_part *svcpt,
2411                      struct ptlrpc_thread *thread)
2412    {
2413            /* Don't exit while there are replies to be handled */
2414            struct l_wait_info lwi = LWI_TIMEOUT(svcpt->scp_rqbd_timeout,
2415                                                 ptlrpc_retry_rqbds, svcpt);
2416

However, it shows the wrong source code in crash's dis -s command.

crash-7.3.0_gdb-7.6_x86_64> mod -s ptlrpc /usr/lib/debug/usr/lib/modules/3.10.0-957.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko.debug
     MODULE       NAME                                BASE           SIZE  OBJECT FILE
ffffffffc11f17e0  ptlrpc                        ffffffffc1079000  2240746  /usr/lib/debug/usr/lib/modules/3.10.0-957.el7_lustre.x86_64/extra/lustre/fs/ptlrpc.ko.debug

crash-7.3.0_gdb-7.6_x86_64> dis -s ptlrpc_wait_event
FILE: /usr/src/debug/lustre-2.10.6/lustre/ptlrpc/service.c
LINE: 671

  666                   OBD_FREE(array->paa_reqs_count, sizeof(__u32) * size);
  667                   array->paa_reqs_count = NULL;
  668           }
  669
  670           if (array->paa_reqs_array != NULL) {
* 671                   OBD_FREE(array->paa_reqs_array,
  672                            sizeof(struct list_head) * array->paa_size);
  673                   array->paa_reqs_array = NULL;
  674           }
  675
  676           return -ENOMEM;
  677   }

Is it ok to use the debuginfo from other builds? I don't have the source code and debuginfo file for the module installed in the system now.

yangliping avatar Jun 28 '21 02:06 yangliping

Is it ok to use the debuginfo from other builds?

Unfortunately no. crash uses some gdb functions and commands internally to achieve "dis -s" command, it will cause reference gaps and fail to get the correct output with an unsuited debuginfo.

k-hagio avatar Jun 29 '21 05:06 k-hagio

Thanks for your comment. How can I know where the reference gaps are? Is it possible to fix it in a few simple steps?

yangliping avatar Jun 29 '21 06:06 yangliping