Changeset 9286475 in mainline


Ignore:
Timestamp:
2018-10-11T13:52:08Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8fefd8b
Parents:
63a045c
Message:

Set task name to full path instead of just the base name

This eliminates the guesswork it takes to determine path to the binary.
It is a stopgap measure. Eventually we want a better solution.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/sysinfo.h

    r63a045c r9286475  
    4646
    4747/** Maximum name sizes */
    48 #define TASK_NAME_BUFLEN  20
     48#define TASK_NAME_BUFLEN  64
    4949#define EXC_NAME_BUFLEN   20
    5050
  • uspace/app/taskdump/taskdump.c

    r63a045c r9286475  
    405405static void autoload_syms(void)
    406406{
    407         char *file_name;
    408         errno_t rc;
    409         int ret;
    410 
    411407        assert(app_name != NULL);
    412408        assert(app_symtab == NULL);
    413409
    414         ret = asprintf(&file_name, "/app/%s", app_name);
    415         if (ret < 0) {
    416                 printf("Memory allocation failure.\n");
    417                 exit(1);
    418         }
    419 
    420         rc = symtab_load(file_name, &app_symtab);
    421         if (rc == EOK) {
    422                 printf("Loaded symbol table from %s\n", file_name);
    423                 free(file_name);
     410        if (app_name[0] != '/') {
     411                printf("Task name is not path. Can't autoload symbol table.\n");
    424412                return;
    425413        }
    426414
    427         free(file_name);
    428 
    429         ret = asprintf(&file_name, "/srv/%s", app_name);
    430         if (ret < 0) {
    431                 printf("Memory allocation failure.\n");
    432                 exit(1);
    433         }
    434 
    435         rc = symtab_load(file_name, &app_symtab);
    436         if (rc == EOK) {
    437                 printf("Loaded symbol table from %s\n", file_name);
    438                 free(file_name);
     415        errno_t rc = symtab_load(app_name, &app_symtab);
     416        if (rc != EOK) {
     417                printf("Failed autoloading symbol table: %s\n",
     418                    str_error_name(rc));
    439419                return;
    440420        }
    441421
    442         ret = asprintf(&file_name, "/drv/%s/%s", app_name, app_name);
    443         if (ret < 0) {
    444                 printf("Memory allocation failure.\n");
    445                 exit(1);
    446         }
    447 
    448         rc = symtab_load(file_name, &app_symtab);
    449         if (rc == EOK) {
    450                 printf("Loaded symbol table from %s\n", file_name);
    451                 free(file_name);
    452                 return;
    453         }
    454 
    455         free(file_name);
    456         printf("Failed autoloading symbol table.\n");
     422        printf("Loaded symbol table from %s\n", app_name);
    457423}
    458424
  • uspace/lib/c/generic/loader.c

    r63a045c r9286475  
    189189errno_t loader_set_program_path(loader_t *ldr, const char *path)
    190190{
    191         const char *name = str_rchr(path, '/');
    192         if (name == NULL) {
    193                 name = path;
    194         } else {
    195                 name++;
    196         }
     191        size_t abslen;
     192        char *abspath = vfs_absolutize(path, &abslen);
     193        if (!abspath)
     194                return ENOMEM;
    197195
    198196        int fd;
     
    202200        }
    203201
    204         rc = loader_set_program(ldr, name, fd);
     202        rc = loader_set_program(ldr, path, fd);
    205203        vfs_put(fd);
    206204        return rc;
Note: See TracChangeset for help on using the changeset viewer.