Author: cwittich
Date: Mon Sep 15 12:08:46 2008
New Revision: 36262
URL:
http://svn.reactos.org/svn/reactos?rev=36262&view=rev
Log:
raddr2line traces for umode
Modified:
trunk/tools/sysreg2/console.c
trunk/tools/sysreg2/makefile
trunk/tools/sysreg2/sysreg.h
trunk/tools/sysreg2/virt.c
Modified: trunk/tools/sysreg2/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/console.c?rev=36262&…
==============================================================================
--- trunk/tools/sysreg2/console.c [iso-8859-1] (original)
+++ trunk/tools/sysreg2/console.c [iso-8859-1] Mon Sep 15 12:08:46 2008
@@ -7,7 +7,7 @@
int ttyfd, i;
struct termios ttyattr, rawattr;
bool Ret = true;
- bool KdbgHit = false;
+ int KdbgHit = 0;
if ((ttyfd = open(tty, O_NOCTTY | O_RDWR)) < 0)
{
@@ -58,38 +58,36 @@
continue;
if (fds[i].revents & POLLIN)
{
- char buf[4096];
+ char buf[512];
+ char rbuf[512];
int got, sent = 0;
memset(buf, 0, sizeof(buf));
got = readln(fds[i].fd, buf, sizeof(buf));
- if (got == -2) /* kernel debugger */
+ if (got == KDBG_READY)
{
- if (KdbgHit)
+ KdbgHit++;
+ switch (KdbgHit)
{
- Ret = false;
- goto cleanup;
- }
- else
- {
- KdbgHit = true;
- safewrite(ttyfd, "bt\r", 3);
- continue;
+ case 1:
+ safewrite(ttyfd, "bt\r", 3);
+ continue;
+ default:
+ Ret = false;
+ goto cleanup;
+
}
}
- else if (got == -3) /* kernel debugger */
+ else if (got == KDBG_CONFIRM)
{
+ /* send <Return>
+ * to get more data */
safewrite(ttyfd, "\r", 1);
continue;
}
- if (got < 0) {
+ else if (got <= 0) {
goto cleanup;
}
- if (!got)
- {
- goto cleanup;
- }
-
if (fds[i].fd != STDIN_FILENO)
{
if ((AppSettings.Stage[stage].Checkpoint[0] != '\0')
&&
@@ -99,21 +97,11 @@
* kill the vm and return success */
goto cleanup;
}
-
- printf("%s", buf);
- /*
- while (sent < got)
- {
- int done;
- if ((done = safewrite(STDOUT_FILENO,
- buf + sent, got - sent)) <= 0)
- {
- Ret = false;
- goto cleanup;
- }
- sent += done;
- }
- */
+
+ if (ResolveAddressFromFile(rbuf, sizeof(rbuf), buf))
+ printf("%s", rbuf);
+ else
+ printf("%s", buf);
}
else
{
Modified: trunk/tools/sysreg2/makefile
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/makefile?rev=36262&a…
==============================================================================
--- trunk/tools/sysreg2/makefile [iso-8859-1] (original)
+++ trunk/tools/sysreg2/makefile [iso-8859-1] Mon Sep 15 12:08:46 2008
@@ -10,7 +10,7 @@
LIBS := -lgcc -lm -lvirt -ltasn1 -lz -lxml2 -lgnutls
INC := -I/usr/include/libvirt/ -I/usr/include/libxml2/
-SRCS := virt.c utils.c console.c options.c
+SRCS := virt.c utils.c console.c options.c raddr2line.c
OBJS := $(SRCS:.c=.o)
Modified: trunk/tools/sysreg2/sysreg.h
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/sysreg.h?rev=36262&a…
==============================================================================
--- trunk/tools/sysreg2/sysreg.h [iso-8859-1] (original)
+++ trunk/tools/sysreg2/sysreg.h [iso-8859-1] Mon Sep 15 12:08:46 2008
@@ -9,6 +9,9 @@
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
+
+#define KDBG_CONFIRM -3
+#define KDBG_READY -2
typedef struct {
char BootDevice[8];
@@ -36,3 +39,7 @@
/* console.c */
bool ProcessDebugData(const char* tty, int timeout, int stage);
+
+/* raddr2line.c */
+bool GetPackagePath(char* Buffer, int BuffSize, char* Module);
+bool ResolveAddressFromFile(char* Buffer, int BuffSize, char* Data);
Modified: trunk/tools/sysreg2/virt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/sysreg2/virt.c?rev=36262&…
==============================================================================
--- trunk/tools/sysreg2/virt.c [iso-8859-1] (original)
+++ trunk/tools/sysreg2/virt.c [iso-8859-1] Mon Sep 15 12:08:46 2008
@@ -177,7 +177,6 @@
char buf[100];
while(feof(p)==0)
{
- memset(buf,0,strlen(buf));
fgets(buf,100,p);
printf("%s\n",buf);
}