Dumper

Is there sample source code available if I wanted to write my own version of
dumper?

I am writing embedded applicationsand only have a serial link to a host
system capable of logging. So I just want to peek into the program that
dumper and record a few things throught the serial link.

“Bill at Sierra Design” <BC@SierraDesign.com> wrote in message
news:91329j$clf$1@inn.qnx.com

Is there sample source code available if I wanted to write my own version
of
dumper?

I use the following code after reception of a death message (got to set you
program as server)

#include <sys/dumper.h>

static void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
FILE *fd;
time_t time_of_day;

// — info comes from QNX this isn’t documented anywhere AFAIK

hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;

qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// — now print to stdout any values required, including any registers
// — content
time_of_day = time( NULL );
printf( “Event at %s”, ctime( &time_of_day ) );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”, pid,
hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf(“gs:%08x fs:%08x es:%08x ds:%08x\n”, hdr.reg.gs, hdr.reg.fs,
hdr.reg.es, hdr.reg.ds );
printf(“bp:%08x sp:%08x bx:%08x dx:%08x\n”, hdr.reg.bp, hdr.reg.sp,
hdr.reg.bx, hdr.reg.dx );
printf(“cx:%08x ax:%08x ip:%08x fl:%08x\n”, hdr.reg.cx, hdr.reg.ax,
hdr.reg.ip, hdr.reg.fl );
printf(“ss:%08x \n\n”, hdr.reg.ss );

}

I am writing embedded applicationsand only have a serial link to a host
system capable of logging. So I just want to peek into the program that
dumper and record a few things throught the serial link.

Cool!

Thanks Mario.

Since this is triggered via a Death Message, I assume that it can be run in
addition to the QNX dumper, at least on my development machine, where there
is a local hard disk.


Mario Charest <mcharest@void_zinformatic.com> wrote in message
news:9139tt$ksn$1@nntp.qnx.com

“Bill at Sierra Design” <> BC@SierraDesign.com> > wrote in message
news:91329j$clf$> 1@inn.qnx.com> …
Is there sample source code available if I wanted to write my own
version
of
dumper?


I use the following code after reception of a death message (got to set
you
program as server)

#include <sys/dumper.h

static void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
FILE *fd;
time_t time_of_day;

// — info comes from QNX this isn’t documented anywhere AFAIK

hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;

qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// — now print to stdout any values required, including any registers
// — content
time_of_day = time( NULL );
printf( “Event at %s”, ctime( &time_of_day ) );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”, pid,
hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf(“gs:%08x fs:%08x es:%08x ds:%08x\n”, hdr.reg.gs, hdr.reg.fs,
hdr.reg.es, hdr.reg.ds );
printf(“bp:%08x sp:%08x bx:%08x dx:%08x\n”, hdr.reg.bp, hdr.reg.sp,
hdr.reg.bx, hdr.reg.dx );
printf(“cx:%08x ax:%08x ip:%08x fl:%08x\n”, hdr.reg.cx, hdr.reg.ax,
hdr.reg.ip, hdr.reg.fl );
printf(“ss:%08x \n\n”, hdr.reg.ss );

}

I am writing embedded applicationsand only have a serial link to a host
system capable of logging. So I just want to peek into the program that
dumper and record a few things throught the serial link.
\

“Bill at Sierra Design” <BC@SierraDesign.com> wrote in message
news:913k0d$mt1$1@inn.qnx.com

Cool!

Thanks Mario.

My pleasure!

Since this is triggered via a Death Message, I assume that it can be run
in
addition to the QNX dumper, at least on my development machine, where
there
is a local hard disk.

Yes I beleive so, being a “server” the kernel will wait until all
“servers” have replied before really killing the process. That’s why
“servers” have to be fast.

Mario Charest <mcharest@void_zinformatic.com> wrote in message
news:9139tt$ksn$> 1@nntp.qnx.com> …

“Bill at Sierra Design” <> BC@SierraDesign.com> > wrote in message
news:91329j$clf$> 1@inn.qnx.com> …
Is there sample source code available if I wanted to write my own
version
of
dumper?


I use the following code after reception of a death message (got to set
you
program as server)

#include <sys/dumper.h

static void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
FILE *fd;
time_t time_of_day;

// — info comes from QNX this isn’t documented anywhere AFAIK

hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;

qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// — now print to stdout any values required, including any registers
// — content
time_of_day = time( NULL );
printf( “Event at %s”, ctime( &time_of_day ) );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”, pid,
hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf(“gs:%08x fs:%08x es:%08x ds:%08x\n”, hdr.reg.gs, hdr.reg.fs,
hdr.reg.es, hdr.reg.ds );
printf(“bp:%08x sp:%08x bx:%08x dx:%08x\n”, hdr.reg.bp, hdr.reg.sp,
hdr.reg.bx, hdr.reg.dx );
printf(“cx:%08x ax:%08x ip:%08x fl:%08x\n”, hdr.reg.cx, hdr.reg.ax,
hdr.reg.ip, hdr.reg.fl );
printf(“ss:%08x \n\n”, hdr.reg.ss );

}

I am writing embedded applicationsand only have a serial link to a
host
system capable of logging. So I just want to peek into the program
that
dumper and record a few things throught the serial link.


\