Re: [PATCH 2/2] trace-cmd: Save the tracee memory map into the trace.dat file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Jun 2019 09:37:22 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> As stated in the last email. The vector size is hard coded as 2, which
> is why I'm reluctant to add a vector version now. If it was dynamic,
> then that would be more of a reason. Here we can just create our own
> structure and use that:
> 
> 	struct tracecmd_map_file {
> 		int		nr_maps;
> 		int		maps_len;
> 		char		*maps;
> 	}
> 
> Or something like that.

As you can't send that to the tracecmd_add_option, you would need
something more like this:

	struct tracecmd_map_file {
		int		nr_maps;
		int		maps_len;
		char		maps[0];
	};

And then you would need to copy it first before sending it:


	struct tracecmd_map_file *tmap;

	tmap = malloc(sizeof(*tmap) + s.len + 1);
	
	and copy the buffer:

	memcpy(&tmap->maps[0], s.buffer, s.len + 1);

before sending it to tracecmd_add_option();

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux