<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.7">
<TITLE>RE: [Crash-utility] Include file for extensions</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<BR>

<P><FONT SIZE=2>Yes it's fine.<BR>
<BR>
It's been a while now - but I do remember trying relative hard to include defs.h.<BR>
At the time it did look like a bit too much to handle. But like my comment says if someone wants to give it a try that would be great.<BR>
<BR>
  -Luc<BR>
<BR>
-----Original Message-----<BR>
From: Dave Anderson [<A HREF="mailto:anderson@redhat.com">mailto:anderson@redhat.com</A>]<BR>
Sent: Thu 4/30/2009 2:06 PM<BR>
To: Discussion list for crash utility usage, maintenance and development<BR>
Cc: Chouinard, Luc; Chouinard, Luc<BR>
Subject: Re: [Crash-utility] Include file for extensions<BR>
<BR>
<BR>
----- "Michael Holzheu" <holzheu@linux.vnet.ibm.com> wrote:<BR>
<BR>
> Hi again,<BR>
><BR>
> We found a problem in sial. Because sial.c does not include defs.h, for<BR>
> all used functions like "ulong symbol_value(char *)", that do not have a<BR>
> prototype, the compiler assumes that the return value is int.  Therefore<BR>
> we get wrong results.<BR>
><BR>
> A comment in sial.c says:<BR>
><BR>
> // some stuff from crash's defs.h, file which cannot be included here.<BR>
> // Hate to do this but this is a quick port..<BR>
> // If anyone cares to work on the include and defs structure to make<BR>
> // this work cleanly...<BR>
><BR>
> If you compile sial with "-Wall" you get:<BR>
><BR>
> gcc -g -I.. -Ilibsial -I../gdb-6.1/bfd -I../gdb-6.1/include<BR>
> -I../gdb-6.1/gdb -I../gdb-6.1/gdb/config -nostartfiles -shared<BR>
> -rdynamic<BR>
> -o sial.so sial.c -fPIC -DS390X -Wall -Llibsial -lsial<BR>
> sial.c: In function 'apigetmem':<BR>
> sial.c:96: warning: implicit declaration of function 'readmem'<BR>
> sial.c: In function 'apigetval':<BR>
> sial.c:424: warning: implicit declaration of function 'symbol_exists'<BR>
> sial.c:425: warning: implicit declaration of function 'symbol_value'<BR>
> sial.c: In function 'apigetdefs':<BR>
> sial.c:572: warning: implicit declaration of function 'sial_addneg'<BR>
> sial.c: In function 'edit_cmd':<BR>
> sial.c:676: warning: implicit declaration of function 'cmd_usage'<BR>
> sial.c: In function 'rm_sial_cmd':<BR>
> sial.c:842: warning: unused variable 'end'<BR>
> sial.c: At top level:<BR>
> sial.c:917: warning: return type defaults to 'int'<BR>
> sial.c: In function '_init':<BR>
> sial.c:1013: warning: implicit declaration of function<BR>
> 'register_extension'<BR>
><BR>
> To solve the problem, we could either define an small official API<BR>
> include file for crash extensions (crash.h?), make defs.h include-able<BR>
> or just do the quick and ugly fix that declares the missing functions in<BR>
> sial.c.<BR>
<BR>
No, there's no need for a "crash.h" file, because by definition crash<BR>
extensions modules are *supposed* to #include "defs.h".  In fact, the<BR>
crash-devel subpackage solely consists of "/usr/include/crash/defs.h"<BR>
for extension module writers. <BR>
<BR>
But Luc Chouinard apparently ran into some difficulties with duplicate<BR>
declarations or something like that when he did the port.<BR>
<BR>
Anyway, I don't touch the SIAL stuff, and even though the patch below is<BR>
fine with me, I'll defer to Luc Chouinard to see if he wants to address<BR>
it otherwise.  I've cc'd him directly with this response -- he'll probably<BR>
say it's fine.<BR>
<BR>
Thanks,<BR>
  Dave<BR>
<BR>
><BR>
> Michael<BR>
><BR>
> The following is the fix for solution (3):<BR>
> ---<BR>
>  extensions/sial.c |    7 +++++++<BR>
>  1 file changed, 7 insertions(+)<BR>
><BR>
> Index: crash-4.0-8.9/extensions/sial.c<BR>
> ===================================================================<BR>
> --- crash-4.0-8.9.orig/extensions/sial.c<BR>
> +++ crash-4.0-8.9/extensions/sial.c<BR>
> @@ -84,6 +84,13 @@ struct command_table_entry {           <BR>
>  extern FILE *fp;<BR>
>  extern char *crash_global_cmd();<BR>
> <BR>
> +typedef unsigned long long int ulonglong;<BR>
> +extern int readmem(ulonglong, int, void *, long, char *, ulong);<BR>
> +extern int symbol_exists(char *);<BR>
> +extern ulong symbol_value(char *);<BR>
> +extern void cmd_usage(char *, int);<BR>
> +extern void register_extension(struct command_table_entry *);<BR>
> +<BR>
>  //<BR>
><BR>
> /////////////////////////////////////////////////////////////////////////<BR>
>  /*<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>