Skip to content

"ls -l" raises usage fault #50

@akioolin

Description

@akioolin

hello, pikoRT developer:

Thank you for create this wonder land.

the following is how to generate the fault which i meet.

after OS boot sequence complete, the prompt will be displayed.
type the below 'ls' operation, will cause system hang up.

step 1. type 'ls'
step 2. type 'ls -l'
step 3. type 'ls'

the system will show the message like below:

#UsageFault

r0: 00000000 r1: 00003e73 r2: 00000002 r3: 00000014
r4: 00000008 r5: 200011f8 r6: 00000000 r7: 00003e73
r8: 00000002 r9: 00003688 r10: 20000f9c r11: 00000000
r12: 0000002d sp: 20028f90 lr: 000034a5 pc: 00002d82

EXC_RETURN: fffffff1
ufsr: 00000002 <INVSTATE>
-------------------------------------------------------------

-------------------------------------------------------------
#HardFault

r0: 00000000 r1: 00003e73 r2: 00000002 r3: 00000014
r4: 00000008 r5: 200011f8 r6: 00000000 r7: 00003e73
r8: 00000002 r9: 00003688 r10: 20000f9c r11: 00000000
r12: 0000002d sp: 20028f90 lr: 000034a5 pc: 00002d82

EXC_RETURN: fffffff1

for trying to understand the 'ls' command's flow, i try to add come code in the
below code piece.

    if (argc == 1)
        dir = opendir("/");  // FIXME: get current directory
    else {
        dir = opendir(argv[1]);
        printk("argv[1]=>%s, open %s\n", argv[1], (dir==NULL) ? "no dir":" done");
    }

    do {
        readdir_r(dir, &dirent, &result);
        if (result != NULL)
            printk("% 6d %s\n", dirent.d_ino, dirent.d_name);
    } while (result != NULL);
    closedir(dir);

the question is after step 3., the system will hang on. what is the root cause of this problem?
how to fix this problem?

Thank you very much.

BR,
Akio

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions