Enable kernel text line number capability for the "dis -l", "bt -l",

"sys -c", and "sym" commands for kernels that are configured with
CONFIG_RANDOMIZE_BASE.
(anderson@redhat.com)
This commit is contained in:
Dave Anderson 2014-02-27 16:35:45 -05:00
parent b8db9a76e9
commit dbb01ee68a
4 changed files with 10 additions and 6 deletions

2
defs.h
View File

@ -2447,6 +2447,8 @@ struct symbol_table_data {
#define MODSECT_VMASK (MODSECT_V1|MODSECT_V2|MODSECT_V3)
#define NO_STRIP (0x10000)
#define NO_LINE_NUMBERS() ((st->flags & GDB_SYMS_PATCHED) && !(kt->flags2 & KASLR))
#endif /* !GDB_COMMON */
#define ALL_MODULES (0)

View File

@ -1377,7 +1377,7 @@ cmd_dis(void)
break;
case 'l':
if (GDB_PATCHED())
if (NO_LINE_NUMBERS())
error(INFO, "line numbers are not available\n");
else
req->flags |= GNU_PRINT_LINE_NUMBERS;
@ -2040,7 +2040,7 @@ cmd_bt(void)
break;
case 'l':
if (GDB_PATCHED())
if (NO_LINE_NUMBERS())
error(INFO, "line numbers are not available\n");
else
bt->flags |= BT_LINE_NUMBERS;
@ -4912,7 +4912,7 @@ dump_sys_call_table(char *spec, int cnt)
#else
ulong *sys_call_table, *sct, sys_ni_syscall, addr;
#endif
if (GDB_PATCHED())
if (NO_LINE_NUMBERS())
error(INFO, "line numbers are not available\n");
NR_syscalls = get_NR_syscalls(&confirmed);

View File

@ -3823,13 +3823,15 @@ get_line_number(ulong addr, char *buf, int reserved)
struct load_module *lm;
buf[0] = NULLCHAR;
if (!is_kernel_text(addr) || GDB_PATCHED())
if (NO_LINE_NUMBERS() || !is_kernel_text(addr))
return(buf);
if (module_symbol(addr, NULL, &lm, NULL, 0)) {
if (!(lm->mod_flags & MOD_LOAD_SYMS))
return(buf);
}
} else if (kt->flags2 & KASLR)
addr -= (kt->relocate * -1);
if ((lnh = machdep->line_number_hooks)) {
name = closest_symbol(addr);

2
task.c
View File

@ -5658,7 +5658,7 @@ foreach(struct foreach_data *fd)
error(FATAL,
"bt: -x and -d options are mutually exclusive\n");
if ((fd->flags & FOREACH_l_FLAG) && GDB_PATCHED()) {
if ((fd->flags & FOREACH_l_FLAG) && NO_LINE_NUMBERS()) {
error(INFO, "line numbers are not available\n");
fd->flags &= ~FOREACH_l_FLAG;
}