Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Crash Utility (http://www.linux-archive.org/crash-utility/)
-   -   Extend the SIAL built-in functions to include memset function. (http://www.linux-archive.org/crash-utility/657179-extend-sial-built-functions-include-memset-function.html)

Aravinda Prasad 04-18-2012 10:45 AM

Extend the SIAL built-in functions to include memset function.
 
On Monday 16 April 2012 11:56 PM, Dave Anderson wrote:



----- Original Message -----

The memset function will be used to specify the virtual address
and the length of the data to be scrubbed in the dump file when
the SIAL macro is used with the makedumpfile command. The
makedumpfile command is currently being enhanced to accept SIAL
macros to scrub data in the dump file.

When used with crash, SIAL macro using memset function will
have no effect (as intended as dump file should not be modified).
This is because the API_PUTMEM call back function implemented
in crash extension layer is a no-op.


OK, but then I don't understand the point of adding this to the
crash utility's version of libsial?


If I am not wrong, the plan is to use the same version of libsial for
both crash and makedumpfile once a new project is created for SIAL. As
it is not yet created, I thought of mailing the patch to crash mailing
list, which would be included in SIAL once the project is created.
However, this patch is not required any more as the functionality can
be achieved by extending the built-in functions using sial_builtin().

Regards,
Aravinda



Dave



Signed-off-by: Aravinda Prasad<aravinda@linux.vnet.ibm.com>
---
extensions/libsial/sial_builtin.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/extensions/libsial/sial_builtin.c
b/extensions/libsial/sial_builtin.c
index e189f5e..05228a4 100644
--- a/extensions/libsial/sial_builtin.c
+++ b/extensions/libsial/sial_builtin.c
@@ -192,6 +192,18 @@ char p[1024];
return sial_setstrval(sial_newval(), p);
}

+value_t *
+sial_memset(value_t* vaddr, value_t* vch, value_t* vlen)
+{
+ull addr=sial_getval(vaddr);
+int len=sial_getval(vlen);
+ull ch=sial_getval(vch);
+
+ API_PUTMEM(addr, (void *)ch, len);
+ return sial_makebtype(1);
+}
+
+
static builtin *bfuncs=0;

/*
@@ -334,6 +346,7 @@ static btspec_t sialbfuncs[] = {
{ "void prarr(string name, int i)", bcast(sial_prarr)},
{ "int member(void*, string name)", bcast(sial_ismember)},
{ "string findsym(string)", bcast(sial_findsym)},
+ { "int memset(char*, int, int)", bcast(sial_memset)},
};








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

Aravinda Prasad 04-18-2012 10:49 AM

Extend the SIAL built-in functions to include memset function.
 
On Tuesday 17 April 2012 12:57 AM, Luc Chouinard wrote:


Aravinda, can you use the sial_builtin() API call to install that function from your application?
It seems like this is a particular use case for makedumpfile only.

You should be able to do this like sial.c does it for the curtask() builtin.


Thanks Luc. Using sial_builtin() API call to install a new function is
simple and easy. I will use it.

Regards,
Aravinda




-Luc

-----Original Message-----
From: Dave Anderson [mailto:anderson@redhat.com]
Sent: Mon 4/16/2012 2:26 PM
To: Aravinda Prasad
Cc: tachibana@mxm.nes.nec.co.jp; kumagai-atsushi@mxc.nes.nec.co.jp; ananth@in.ibm.com; buendgen@de.ibm.com; Luc Chouinard; crash-utility@redhat.com
Subject: Re: [PATCH] Extend the SIAL built-in functions to include memset function.



----- Original Message -----

The memset function will be used to specify the virtual address
and the length of the data to be scrubbed in the dump file when
the SIAL macro is used with the makedumpfile command. The
makedumpfile command is currently being enhanced to accept SIAL
macros to scrub data in the dump file.

When used with crash, SIAL macro using memset function will
have no effect (as intended as dump file should not be modified).
This is because the API_PUTMEM call back function implemented
in crash extension layer is a no-op.


OK, but then I don't understand the point of adding this to the
crash utility's version of libsial?

Dave



Signed-off-by: Aravinda Prasad<aravinda@linux.vnet.ibm.com>
---
extensions/libsial/sial_builtin.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/extensions/libsial/sial_builtin.c
b/extensions/libsial/sial_builtin.c
index e189f5e..05228a4 100644
--- a/extensions/libsial/sial_builtin.c
+++ b/extensions/libsial/sial_builtin.c
@@ -192,6 +192,18 @@ char p[1024];
return sial_setstrval(sial_newval(), p);
}

+value_t *
+sial_memset(value_t* vaddr, value_t* vch, value_t* vlen)
+{
+ull addr=sial_getval(vaddr);
+int len=sial_getval(vlen);
+ull ch=sial_getval(vch);
+
+ API_PUTMEM(addr, (void *)ch, len);
+ return sial_makebtype(1);
+}
+
+
static builtin *bfuncs=0;

/*
@@ -334,6 +346,7 @@ static btspec_t sialbfuncs[] = {
{ "void prarr(string name, int i)", bcast(sial_prarr)},
{ "int member(void*, string name)", bcast(sial_ismember)},
{ "string findsym(string)", bcast(sial_findsym)},
+ { "int memset(char*, int, int)", bcast(sial_memset)},
};








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


All times are GMT. The time now is 05:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.