X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftracefile-tfile.c;h=831f162df7e0272ac446a9be1851f41f133c04b3;hb=67aa1f3c2881e607081d9e1b57be3e7544c2c45c;hp=2327d9e47e3a0e61d1519a51ae24e526d57cca23;hpb=73e1c03f93f0294b464dc2b67de1f9aaae84838d;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 2327d9e47e..831f162df7 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -1,6 +1,6 @@ /* Trace file TFILE format support in GDB. - Copyright (C) 1997-2018 Free Software Foundation, Inc. + Copyright (C) 1997-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -262,31 +262,32 @@ tfile_write_uploaded_tp (struct trace_file_writer *self, fprintf (writer->fp, ":F%x", utp->orig_size); if (utp->cond) fprintf (writer->fp, - ":X%x,%s", (unsigned int) strlen (utp->cond) / 2, - utp->cond); + ":X%x,%s", (unsigned int) strlen (utp->cond.get ()) / 2, + utp->cond.get ()); fprintf (writer->fp, "\n"); - for (char *act : utp->actions) + for (const auto &act : utp->actions) fprintf (writer->fp, "tp A%x:%s:%s\n", - utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act); - for (char *act : utp->step_actions) + utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act.get ()); + for (const auto &act : utp->step_actions) fprintf (writer->fp, "tp S%x:%s:%s\n", - utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act); + utp->number, phex_nz (utp->addr, sizeof (utp->addr)), act.get ()); if (utp->at_string) { encode_source_string (utp->number, utp->addr, - "at", utp->at_string, buf, MAX_TRACE_UPLOAD); + "at", utp->at_string.get (), + buf, MAX_TRACE_UPLOAD); fprintf (writer->fp, "tp Z%s\n", buf); } if (utp->cond_string) { encode_source_string (utp->number, utp->addr, - "cond", utp->cond_string, + "cond", utp->cond_string.get (), buf, MAX_TRACE_UPLOAD); fprintf (writer->fp, "tp Z%s\n", buf); } - for (char *act : utp->cmd_strings) + for (const auto &act : utp->cmd_strings) { - encode_source_string (utp->number, utp->addr, "cmd", act, + encode_source_string (utp->number, utp->addr, "cmd", act.get (), buf, MAX_TRACE_UPLOAD); fprintf (writer->fp, "tp Z%s\n", buf); } @@ -307,7 +308,7 @@ tfile_write_tdesc (struct trace_file_writer *self) = (struct tfile_trace_file_writer *) self; gdb::optional tdesc - = target_fetch_description_xml (target_stack); + = target_fetch_description_xml (current_top_target ()); if (!tdesc) return; @@ -555,7 +556,7 @@ tfile_target_open (const char *arg, int from_tty) END_CATCH inferior_appeared (current_inferior (), TFILE_PID); - inferior_ptid = pid_to_ptid (TFILE_PID); + inferior_ptid = ptid_t (TFILE_PID); add_thread_silent (inferior_ptid); if (ts->traceframe_count <= 0) @@ -615,14 +616,11 @@ tfile_interp_line (char *line, struct uploaded_tp **utpp, void tfile_target::close () { - int pid; - if (trace_fd < 0) return; - pid = ptid_get_pid (inferior_ptid); inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */ - exit_inferior_silent (pid); + exit_inferior_silent (current_inferior ()); ::close (trace_fd); trace_fd = -1;