Skip to content

segfault when given logfile name is already taken by a directory #853

Closed
@honggyukim

Description

@honggyukim

Here is an example recording a simple program.

$ gcc -pg tests/s-abc.c -o t-abc

$ uftrace record t-abc

$ uftrace replay
# DURATION     TID     FUNCTION
   1.700 us [ 16855] | __monstartup();
   1.300 us [ 16855] | __cxa_atexit();
            [ 16855] | main() {
            [ 16855] |   a() {
            [ 16855] |     b() {
            [ 16855] |       c() {
   1.400 us [ 16855] |         getpid();
   3.600 us [ 16855] |       } /* c */
   5.600 us [ 16855] |     } /* b */
   7.300 us [ 16855] |   } /* a */
   9.200 us [ 16855] | } /* main */

The above example works fine and the debug message can be stored with --logfile option as follows:

$ uftrace record -v --logfile=dir t-abc

However, it gets crashed if the given file name is already used by another directory as follows:

$ mkdir dir

$ uftrace record -v --logfile=dir t-abc
Segmentation fault (core dumped)

It needs to check if the file is already exists or not.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions