Skip to content
Snippets Groups Projects
Commit dcfad339 authored by Yang Sheng's avatar Yang Sheng
Browse files

Branch HEAD

b=16283
i=adilger, sheng.yang

Handle the new option for rhel5 /proc/mounts.
parent 0f6ec48f
No related merge requests found
...@@ -787,9 +787,8 @@ static int jt_dbg_modules_2_5(int argc, char **argv) ...@@ -787,9 +787,8 @@ static int jt_dbg_modules_2_5(int argc, char **argv)
char *path = ""; char *path = "";
char *kernel = "linux"; char *kernel = "linux";
const char *proc = "/proc/modules"; const char *proc = "/proc/modules";
char modname[128], others[4096]; char modname[128], buf[4096];
long modaddr; long modaddr;
int rc;
FILE *file; FILE *file;
if (argc >= 2) if (argc >= 2)
...@@ -807,15 +806,17 @@ static int jt_dbg_modules_2_5(int argc, char **argv) ...@@ -807,15 +806,17 @@ static int jt_dbg_modules_2_5(int argc, char **argv)
return 0; return 0;
} }
while ((rc = fscanf(file, "%s %s %s %s %s %lx\n", while (fgets(buf, sizeof(buf), file) != NULL) {
modname, others, others, others, others, &modaddr)) == 6) { if (sscanf(buf, "%s %*s %*s %*s %*s %lx", modname, &modaddr) == 2) {
for (mp = mod_paths; mp->name != NULL; mp++) { for (mp = mod_paths; mp->name != NULL; mp++) {
if (!strcmp(mp->name, modname)) if (!strcmp(mp->name, modname))
break; break;
} }
if (mp->name) { if (mp->name) {
printf("add-symbol-file %s%s%s/%s.o 0x%0lx\n", path, printf("add-symbol-file %s%s%s/%s.o 0x%0lx\n",
path[0] ? "/" : "", mp->path, mp->name, modaddr); path, path[0] ? "/" : "",
mp->path, mp->name, modaddr);
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment