thread.c (b7e56edba4b02f2079042c326a8cd72a44635817) | thread.c (faa5c5c36ec50bf43e39c7798ce9701e6b002db3) |
---|---|
1#include "../perf.h" 2#include <stdlib.h> 3#include <stdio.h> 4#include <string.h> 5#include "session.h" 6#include "thread.h" 7#include "util.h" 8#include "debug.h" --- 22 unchanged lines hidden (view full) --- 31 return self; 32} 33 34int thread__set_comm(struct thread *self, const char *comm) 35{ 36 if (self->comm) 37 free(self->comm); 38 self->comm = strdup(comm); | 1#include "../perf.h" 2#include <stdlib.h> 3#include <stdio.h> 4#include <string.h> 5#include "session.h" 6#include "thread.h" 7#include "util.h" 8#include "debug.h" --- 22 unchanged lines hidden (view full) --- 31 return self; 32} 33 34int thread__set_comm(struct thread *self, const char *comm) 35{ 36 if (self->comm) 37 free(self->comm); 38 self->comm = strdup(comm); |
39 return self->comm ? 0 : -ENOMEM; | 39 if (self->comm == NULL) 40 return -ENOMEM; 41 self->comm_set = true; 42 return 0; |
40} 41 42int thread__comm_len(struct thread *self) 43{ 44 if (!self->comm_len) { 45 if (!self->comm) 46 return 0; 47 self->comm_len = strlen(self->comm); --- 202 unchanged lines hidden (view full) --- 250 } 251 return 0; 252} 253 254int thread__fork(struct thread *self, struct thread *parent) 255{ 256 int i; 257 | 43} 44 45int thread__comm_len(struct thread *self) 46{ 47 if (!self->comm_len) { 48 if (!self->comm) 49 return 0; 50 self->comm_len = strlen(self->comm); --- 202 unchanged lines hidden (view full) --- 253 } 254 return 0; 255} 256 257int thread__fork(struct thread *self, struct thread *parent) 258{ 259 int i; 260 |
258 if (self->comm) 259 free(self->comm); 260 self->comm = strdup(parent->comm); 261 if (!self->comm) 262 return -ENOMEM; | 261 if (parent->comm_set) { 262 if (self->comm) 263 free(self->comm); 264 self->comm = strdup(parent->comm); 265 if (!self->comm) 266 return -ENOMEM; 267 self->comm_set = true; 268 } |
263 264 for (i = 0; i < MAP__NR_TYPES; ++i) 265 if (map_groups__clone(&self->mg, &parent->mg, i) < 0) 266 return -ENOMEM; 267 return 0; 268} 269 270size_t perf_session__fprintf(struct perf_session *self, FILE *fp) --- 6 unchanged lines hidden (view full) --- 277 278 ret += thread__fprintf(pos, fp); 279 } 280 281 return ret; 282} 283 284struct symbol *map_groups__find_symbol(struct map_groups *self, | 269 270 for (i = 0; i < MAP__NR_TYPES; ++i) 271 if (map_groups__clone(&self->mg, &parent->mg, i) < 0) 272 return -ENOMEM; 273 return 0; 274} 275 276size_t perf_session__fprintf(struct perf_session *self, FILE *fp) --- 6 unchanged lines hidden (view full) --- 283 284 ret += thread__fprintf(pos, fp); 285 } 286 287 return ret; 288} 289 290struct symbol *map_groups__find_symbol(struct map_groups *self, |
285 struct perf_session *session, | |
286 enum map_type type, u64 addr, 287 symbol_filter_t filter) 288{ 289 struct map *map = map_groups__find(self, type, addr); 290 291 if (map != NULL) | 291 enum map_type type, u64 addr, 292 symbol_filter_t filter) 293{ 294 struct map *map = map_groups__find(self, type, addr); 295 296 if (map != NULL) |
292 return map__find_symbol(map, session, map->map_ip(map, addr), filter); | 297 return map__find_symbol(map, map->map_ip(map, addr), filter); |
293 294 return NULL; 295} | 298 299 return NULL; 300} |