From: Don Slutz <dslutz(a)verizon.com>
Signed-off-by: Don Slutz <dslutz(a)verizon.com>
---
defs.h | 1 +
kernel.c | 22 ++++++++++++++++++++--
remote.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/defs.h b/defs.h
index 94ba495..adbfadc 100755
--- a/defs.h
+++ b/defs.h
@@ -5528,6 +5528,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..ab50361 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_ACTIVE())
+ fprintf(fp, "%s@%s (remote 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_ACTIVE()))
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_ACTIVE() && ((bt->task == tt->this_task) ||
is_task_active(bt->task))) {
+ if (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) {
@@ -9210,3 +9216,15 @@ dump_variable_length_record(void)
hq_close();
}
+
+/*
+ * Specify Emacs local variables so the formating
+ * of the code stays the same.
+ *
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 8
+ * indent-tabs-mode: t
+ * End:
+ */
diff --git a/remote.c b/remote.c
index 2186af9..4b0388d 100755
--- a/remote.c
+++ b/remote.c
@@ -2382,6 +2382,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, *p3, *p4, *p5, *p6;
+ int errflag;
+ ulong value;
+
+ if (!rc->remoteType[0])
+ return 1; /* 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 1;
+ errflag = remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, pc->flags2 &
REMOTE_NIL);
+ if (errflag <= 0)
+ return 1;
+
+ 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 1;
+ }
+ p1 = strtok(recvbuf, " "); /* FETCH_LIVE_IP_SP_BP */
+ p1 = strtok(NULL, " "); /* cpu */
+ p1 = strtok(NULL, ":"); /* cs */
+ p2 = strtok(NULL, " "); /* ip */
+ p3 = strtok(NULL, ":"); /* ss */
+ p4 = strtok(NULL, " "); /* sp */
+ p5 = strtok(NULL, " "); /* bp */
+
+ errflag = 0;
+ value = htol(p2, RETURN_ON_ERROR|QUIET, &errflag);
+ if (!errflag) {
+ *eip = value;
+ }
+
+ errflag = 0;
+ value = htol(p4, RETURN_ON_ERROR|QUIET, &errflag);
+ if (!errflag) {
+ *esp = value;
+ }
+ return 0;
+}
+
+/*
*
* Set up the file descriptors and file name strings if they haven't
* been set up before:
--
1.8.4