From: Don Slutz <dslutz@xxxxxxxxxxx> Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> --- defs.h | 1 + kernel.c | 10 +++++++-- remote.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 75 insertions(+), 12 deletions(-) diff --git a/defs.h b/defs.h index 489e4cc..de10b70 100755 --- a/defs.h +++ b/defs.h @@ -5529,6 +5529,7 @@ void dump_sockets_workhorse(ulong, ulong, struct reference *); int is_remote_daemon(char *); physaddr_t get_remote_phys_base(physaddr_t, physaddr_t); physaddr_t remote_vtop(int, physaddr_t); +int get_remote_regs(struct bt_info *, ulong *, ulong *); void remote_fd_init(void); int get_remote_file(struct remote_file *); uint remote_page_size(void); diff --git a/kernel.c b/kernel.c index 7b451c9..9c181ee 100755 --- a/kernel.c +++ b/kernel.c @@ -1116,6 +1116,9 @@ non_matching_kernel(void) if (REMOTE_DUMPFILE()) fprintf(fp, "%s@%s (remote dumpfile)\n", pc->server_memsrc, pc->server); + else if (REMOTE_PAUSED()) + fprintf(fp, "%s@%s (remote paused system)\n", + pc->server_memsrc, pc->server); else { if (dumpfile_is_split()) show_split_dumpfiles(); @@ -2408,7 +2411,7 @@ back_trace(struct bt_info *bt) (BT_KSTACKP|BT_TEXT_SYMBOLS|BT_TEXT_SYMBOLS_ALL))) fprintf(fp, "(active)\n"); - if (!(bt->flags & (BT_TEXT_SYMBOLS|BT_TEXT_SYMBOLS_ALL))) + if (!(bt->flags & (BT_TEXT_SYMBOLS|BT_TEXT_SYMBOLS_ALL) || REMOTE_PAUSED())) return; } @@ -2486,7 +2489,10 @@ back_trace(struct bt_info *bt) get_xendump_regs(bt, &eip, &esp); else if (SADUMP_DUMPFILE()) get_sadump_regs(bt, &eip, &esp); - else + else if (REMOTE_PAUSED()) { + if (!is_task_active(bt->task) || !get_remote_regs(bt, &eip, &esp)) + machdep->get_stack_frame(bt, &eip, &esp); + } else machdep->get_stack_frame(bt, &eip, &esp); if (bt->flags & BT_KSTACKP) { diff --git a/remote.c b/remote.c index 23d17fe..b8a00a7 100755 --- a/remote.c +++ b/remote.c @@ -2357,32 +2357,31 @@ remote_vtop(int cpu, physaddr_t virt_addr) { char sendbuf[BUFSIZE]; char recvbuf[BUFSIZE]; - char *p1, *p2, *p3, *p4; + char *p1; int errflag; ulong value; - if (!rc->remoteType[0]) + if (!rc->remote_type[0]) return 0; /* Not a special remote. */ BZERO(sendbuf, BUFSIZE); BZERO(recvbuf, BUFSIZE); - sprintf(sendbuf, "VTOP %d %llx", cpu, virt_addr); + sprintf(sendbuf, "VTOP %d %llx", cpu, (long long unsigned int)virt_addr); remote_tcp_write_string(pc->sockfd, sendbuf); - remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, pc->flags2 & REMOTE_NIL); + remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, NIL_MODE()); if (CRASHDEBUG(2)) - fprintf(fp, "remote_vtop(%d,%llx): [%s]\n", - cpu, virt_addr, recvbuf); + fprintf(fp, "remote_vtop: [%s]\n", recvbuf); if (strstr(recvbuf, "<FAIL>")) error(FATAL, "remote_vtop for CPU %d\n", cpu); p1 = strtok(recvbuf, " "); /* VTOP */ - p2 = strtok(NULL, " "); /* cpu */ - p3 = strtok(NULL, " "); /* vaddr */ - p4 = strtok(NULL, " "); /* paddr */ + p1 = strtok(NULL, " "); /* cpu */ + p1 = strtok(NULL, " "); /* vaddr */ + p1 = strtok(NULL, " "); /* paddr */ errflag = 0; - value = htol(p4, RETURN_ON_ERROR|QUIET, &errflag); + value = htol(p1, RETURN_ON_ERROR|QUIET, &errflag); if (!errflag) { return value; } @@ -2390,6 +2389,63 @@ remote_vtop(int cpu, physaddr_t virt_addr) } /* + * Get a copy of the daemon machine cpu regs. + */ +int +get_remote_regs(struct bt_info *bt, ulong *eip, ulong *esp) +{ + char sendbuf[BUFSIZE]; + char recvbuf[BUFSIZE]; + char *p1, *p2; + int errflag; + ulong value; + + if (!rc->remote_type[0]) + return 0; /* Not a special remote. */ + + *eip = 0; + *esp = 0; + + BZERO(sendbuf, BUFSIZE); + BZERO(recvbuf, BUFSIZE); + sprintf(sendbuf, "FETCH_LIVE_IP_SP_BP %d", bt->tc->processor); + if (remote_tcp_write_string(pc->sockfd, sendbuf)) + return 0; + errflag = remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, NIL_MODE()); + if (errflag <= 0) + return 0; + + if (CRASHDEBUG(1)) + fprintf(fp, "get_remote_regs(cpu=%d): [%s]\n", + bt->tc->processor, recvbuf); + + if (strstr(recvbuf, "<FAIL>")) { + error(INFO, "get_remote_regs for CPU %d\n", bt->tc->processor); + return 0; + } + p1 = strtok(recvbuf, " "); /* FETCH_LIVE_IP_SP_BP */ + p1 = strtok(NULL, " "); /* cpu */ + p1 = strtok(NULL, ":"); /* cs */ + p1 = strtok(NULL, " "); /* ip */ + p2 = strtok(NULL, ":"); /* ss */ + p2 = strtok(NULL, " "); /* sp */ + /* p2 = strtok(NULL, " "); bp */ + + errflag = 0; + value = htol(p1, RETURN_ON_ERROR|QUIET, &errflag); + if (!errflag) { + *eip = value; + } + + errflag = 0; + value = htol(p2, RETURN_ON_ERROR|QUIET, &errflag); + if (!errflag) { + *esp = value; + } + return 1; +} + +/* * * Set up the file descriptors and file name strings if they haven't * been set up before: -- 1.8.4 -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility