Include file for extensions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

We found a problem in sial. Because sial.c does not include defs.h, for
all used functions like "ulong symbol_value(char *)", that do not have a
prototype, the compiler assumes that the return value is int. Therefore
we get wrong results.

A comment in sial.c says:

// some stuff from crash's defs.h, file which cannot be included here.
// Hate to do this but this is a quick port..
// If anyone cares to work on the include and defs structure to make
// this work cleanly...

If you compile sial with "-Wall" you get:

gcc -g -I.. -Ilibsial -I../gdb-6.1/bfd -I../gdb-6.1/include
-I../gdb-6.1/gdb -I../gdb-6.1/gdb/config -nostartfiles -shared -rdynamic
-o sial.so sial.c -fPIC -DS390X -Wall -Llibsial -lsial 
sial.c: In function 'apigetmem':
sial.c:96: warning: implicit declaration of function 'readmem'
sial.c: In function 'apigetval':
sial.c:424: warning: implicit declaration of function 'symbol_exists'
sial.c:425: warning: implicit declaration of function 'symbol_value'
sial.c: In function 'apigetdefs':
sial.c:572: warning: implicit declaration of function 'sial_addneg'
sial.c: In function 'edit_cmd':
sial.c:676: warning: implicit declaration of function 'cmd_usage'
sial.c: In function 'rm_sial_cmd':
sial.c:842: warning: unused variable 'end'
sial.c: At top level:
sial.c:917: warning: return type defaults to 'int'
sial.c: In function '_init':
sial.c:1013: warning: implicit declaration of function
'register_extension'

To solve the problem, we could either define an small official API
include file for crash extensions (crash.h?), make defs.h include-able
or just do the quick and ugly fix that declares the missing functions in
sial.c.

Michael

The following is the fix for solution (3):
---
 extensions/sial.c |    7 +++++++
 1 file changed, 7 insertions(+)

Index: crash-4.0-8.9/extensions/sial.c
===================================================================
--- crash-4.0-8.9.orig/extensions/sial.c
+++ crash-4.0-8.9/extensions/sial.c
@@ -84,6 +84,13 @@ struct command_table_entry {            
 extern FILE *fp; 
 extern char *crash_global_cmd();
 
+typedef unsigned long long int ulonglong;
+extern int readmem(ulonglong, int, void *, long, char *, ulong);
+extern int symbol_exists(char *);
+extern ulong symbol_value(char *);
+extern void cmd_usage(char *, int);
+extern void register_extension(struct command_table_entry *);
+
 //
 /////////////////////////////////////////////////////////////////////////
 /*


--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux