On Thu, Nov 13, 2025 at 5:43 AM <[email protected]> wrote:
> Date: Thu, 13 Nov 2025 10:34:22 +1300 > From: Tao Liu <[email protected]> > Subject: [Crash-utility] [PATCH] Revert "eppic.patch: Add customized > functions to eppic" > To: [email protected] > Cc: Tao Liu <[email protected]> > Message-ID: <[email protected]> > Content-Type: text/plain; charset="US-ASCII"; x-default=true > > This reverts commit 3fc8d4023c0d5dfbf21ea7cdce96a24ece00d4f2 because > the customized functions will be moved to eppic side[1]. So the > eppic.patch is no longer needed. Let's revert those to make a > clean code. > Thank you for the update, Tao. For the patch: Ack. Lianbo > > [1]: https://github.com/lucchouina/eppic/pull/30 > > Signed-off-by: Tao Liu <[email protected]> > --- > > This patch is the follow-up of discussion [2]. > > [2]: > https://www.mail-archive.com/[email protected]/msg01816.html > > --- > extensions/eppic.mk | 9 +- > extensions/eppic.patch | 210 ----------------------------------------- > 2 files changed, 1 insertion(+), 218 deletions(-) > delete mode 100644 extensions/eppic.patch > > diff --git a/extensions/eppic.mk b/extensions/eppic.mk > index bf80dd1..9435793 100644 > --- a/extensions/eppic.mk > +++ b/extensions/eppic.mk > @@ -53,14 +53,7 @@ all: > fi; \ > if [ -f $(APPFILE) ]; \ > then \ > - if patch --dry-run -N -p0 < eppic.patch > >/dev/null ; then \ > - patch -N -p0 < eppic.patch; \ > - make -f eppic.mk eppic.so; \ > - elif patch --dry-run -N -p0 -R < > eppic.patch >/dev/null ; then \ > - make -f eppic.mk eppic.so; \ > - else \ > - echo "eppic.so: apply eppic.patch > error"; \ > - fi; \ > + make -f eppic.mk eppic.so; \ > else \ > echo "eppic.so: failed to pull eppic code > from git repo"; \ > fi; \ > diff --git a/extensions/eppic.patch b/extensions/eppic.patch > deleted file mode 100644 > index 6a08b09..0000000 > --- a/extensions/eppic.patch > +++ /dev/null > @@ -1,210 +0,0 @@ > ---- eppic/applications/crash/eppic.c.orig > -+++ eppic/applications/crash/eppic.c > -@@ -20,6 +20,7 @@ > - #include "defs.h" > - > - #include <eppic_api.h> > -+#include "eppic.h" > - > - /* > - * Global data (global_data.c) > -@@ -788,6 +789,39 @@ char *sclass_help[]={ > - NULL > - }; > - > -+char *eppic_help[]={ > -+ "eppic", > -+ "Run eppic program(es).", > -+ "<fileName1.c>[, <fileName2.c>]", > -+ " Oneshot run eppic program(es) which with a main() > entry each.", > -+ NULL > -+}; > -+ > -+void > -+eppic_command(void) > -+{ > -+ char *buf; > -+ optind = 1; > -+ > -+ if (!args[optind]) { > -+ cmd_usage(crash_global_cmd(), SYNOPSIS); > -+ return; > -+ } > -+ > -+ while(args[optind]) { > -+ buf = eppic_filempath(args[optind]); > -+ if (!buf) { > -+ eppic_msg("eppic_filempath error on %s\n", > args[optind]); > -+ return; > -+ } > -+ eppic_load(buf); > -+ if (eppic_findfile(buf, 0)) > -+ eppic_unload(buf); > -+ eppic_free(buf); > -+ optind++; > -+ } > -+} > -+ > - #define NCMDS 200 > - static struct command_table_entry command_table[NCMDS] = { > - > -@@ -797,6 +831,7 @@ static struct command_table_entry > command_table[NCMDS] = { > - {"sdebug", sdebug_cmd, sdebug_help}, > - {"sname", sname_cmd, sname_help}, > - {"sclass", sclass_cmd, sclass_help}, > -+ {"eppic", eppic_command, eppic_help}, > - {(char *)0 } > - }; > - > -@@ -885,6 +920,13 @@ char **help=malloc(sizeof *help * 5); > - } > - } > - free(help); > -+ > -+ if (load && !strcmp(name, "main")) { > -+ int optind_save = optind; > -+ eppic_cmd(name, NULL, 0); > -+ optind = optind_save; > -+ } > -+ > - return; > - } > - > ---- eppic/libeppic/eppic_api.h.orig > -+++ eppic/libeppic/eppic_api.h > -@@ -16,6 +16,9 @@ > - /* minor and major version number > - 4.0 switch to new Eppic name and use of fully typed symbols. > - */ > -+#ifndef EPPIC_API_H > -+#define EPPIC_API_H > -+ > - #define S_MAJOR 5 > - #define S_MINOR 0 > - > -@@ -298,3 +301,5 @@ void eppic_dbg_named(int class, char *name, int > level, char *, ...); > - > - /* parsers debug flags */ > - extern int eppicdebug, eppicppdebug; > -+ > -+#endif > -\ No newline at end of file > ---- eppic/libeppic/eppic_func.c.orig > -+++ eppic/libeppic/eppic_func.c > -@@ -22,6 +22,8 @@ > - #include <sys/types.h> > - #include <time.h> > - #include <sys/stat.h> > -+#include <fcntl.h> > -+#include <unistd.h> > - #include "eppic.h" > - > - /* > -@@ -793,6 +795,42 @@ char *ed=getenv("EDITOR"); > - if(!system(buf)) eppic_load(fname); > - } > - > -+static const char *example[] = { > -+"/* > ", > -+" * Example: Print all tasks' PID & command > ", > -+" * > ", > -+" * // Kernel's global variables and data structures can be used > directly without", > -+" * // pre-define it in kernel header. If any are within kernel modules, > should", > -+" * // preload the .ko first via \"mod -S/-s\" cmd in crash before > invoke your", > -+" * // eppic program. > ", > -+" * // > ", > -+" * // Eppic program's syntax is similar to C but with slight > differences. ", > -+" * // Code samples: > ", > -+" * // > https://github.com/lucchouina/eppic/tree/master/applications/crash/code", > -+" * // Available eppic functions: > ", > -+" * // > https://github.com/lucchouina/eppic/blob/master/libeppic/eppic_builtin.c#L316 > ", > -+" * > ", > -+" * int main(void) > ", > -+" * { > ", > -+" * struct task_struct *p; > ", > -+" * unsigned long offset; > ", > -+" * > ", > -+" * p = (struct task_struct *)&init_task; > ", > -+" * offset = (unsigned long)&(p->tasks) - (unsigned long)p; > ", > -+" * > ", > -+" * do { > ", > -+" * printf(\"PID: %d Command: %s\\n\", (int)(p->pid), > getstr((char *)&(p->comm[0])));", > -+" * p = (struct task_struct *)((unsigned long)(p->tasks.next) - > offset);", > -+" * } while(p != &init_task); > ", > -+" * > ", > -+" * return 0; > ", > -+" * } > ", > -+" * > ", > -+" * crash> eppic program_file.c > ", > -+" */ > ", > -+}; > -+ > -+char *eppic_get_func_file(char *); > - /* > - This funciton is called to start a vi session on a function > - (file=0) or a file (file=1); > -@@ -800,24 +838,31 @@ char *ed=getenv("EDITOR"); > - void > - eppic_vi(char *fname, int file) > - { > --int line, freeit=0; > -+int line=1, freeit=0, fd; > - char *filename; > -+char newline = '\n'; > - > - if(file) { > - > - filename=eppic_filempath(fname); > - > - if(!filename) { > -- > -- eppic_msg("File not found : %s\n", fname); > -- return; > -- > -- } > -- > -- line=1; > -- freeit=1; > -- > -- > -+ fd = open(fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); > -+ if (fd < 0) { > -+ eppic_msg("File not found : %s\n", fname); > -+ return; > -+ } else { > -+ for (int i = 0; i < sizeof(example)/sizeof(char *); i++) { > -+ write(fd, example[i], strlen(example[i])); > -+ write(fd, &newline, sizeof(newline)); > -+ } > -+ close(fd); > -+ filename = fname; > -+ freeit=0; > -+ } > -+ } else { > -+ freeit=1; > -+ } > - } else { > - > - func *f=eppic_getfbyname(fname, 0); > -@@ -837,6 +882,10 @@ char *filename; > - > - eppic_exevi(filename, line); > - > -+ char *fi_name = eppic_get_func_file("main"); > -+ if (fi_name) > -+ eppic_deletefile(fi_name); > -+ > - if(freeit) eppic_free(filename); > - > - } > -@@ -1184,3 +1233,10 @@ eppic_runcmd(char *fname, var_t*args) > - return 0; > - } > - > -+char *eppic_get_func_file(char *funcname) > -+{ > -+ func *fn = eppic_getfbyname(funcname, 0); > -+ if (!fn) > -+ return NULL; > -+ return fn->file->fname; > -+} > -- > 2.47.0 >
-- Crash-utility mailing list -- [email protected] To unsubscribe send an email to [email protected] https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/ Contribution Guidelines: https://github.com/crash-utility/crash/wiki
