174fe6c29SRuslan Bukin /*
2*85f87cf4SRuslan Bukin * Copyright (c) 2013-2019, Intel Corporation
374fe6c29SRuslan Bukin *
474fe6c29SRuslan Bukin * Redistribution and use in source and binary forms, with or without
574fe6c29SRuslan Bukin * modification, are permitted provided that the following conditions are met:
674fe6c29SRuslan Bukin *
774fe6c29SRuslan Bukin * * Redistributions of source code must retain the above copyright notice,
874fe6c29SRuslan Bukin * this list of conditions and the following disclaimer.
974fe6c29SRuslan Bukin * * Redistributions in binary form must reproduce the above copyright notice,
1074fe6c29SRuslan Bukin * this list of conditions and the following disclaimer in the documentation
1174fe6c29SRuslan Bukin * and/or other materials provided with the distribution.
1274fe6c29SRuslan Bukin * * Neither the name of Intel Corporation nor the names of its contributors
1374fe6c29SRuslan Bukin * may be used to endorse or promote products derived from this software
1474fe6c29SRuslan Bukin * without specific prior written permission.
1574fe6c29SRuslan Bukin *
1674fe6c29SRuslan Bukin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1774fe6c29SRuslan Bukin * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1874fe6c29SRuslan Bukin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1974fe6c29SRuslan Bukin * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2074fe6c29SRuslan Bukin * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2174fe6c29SRuslan Bukin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2274fe6c29SRuslan Bukin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2374fe6c29SRuslan Bukin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2474fe6c29SRuslan Bukin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2574fe6c29SRuslan Bukin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2674fe6c29SRuslan Bukin * POSSIBILITY OF SUCH DAMAGE.
2774fe6c29SRuslan Bukin */
2874fe6c29SRuslan Bukin
2974fe6c29SRuslan Bukin #include "intel-pt.h"
3074fe6c29SRuslan Bukin
3174fe6c29SRuslan Bukin
pt_errstr(enum pt_error_code errcode)3274fe6c29SRuslan Bukin const char *pt_errstr(enum pt_error_code errcode)
3374fe6c29SRuslan Bukin {
3474fe6c29SRuslan Bukin switch (errcode) {
3574fe6c29SRuslan Bukin case pte_ok:
3674fe6c29SRuslan Bukin return "OK";
3774fe6c29SRuslan Bukin
3874fe6c29SRuslan Bukin case pte_internal:
3974fe6c29SRuslan Bukin return "internal error";
4074fe6c29SRuslan Bukin
4174fe6c29SRuslan Bukin case pte_invalid:
4274fe6c29SRuslan Bukin return "invalid argument";
4374fe6c29SRuslan Bukin
4474fe6c29SRuslan Bukin case pte_nosync:
4574fe6c29SRuslan Bukin return "decoder out of sync";
4674fe6c29SRuslan Bukin
4774fe6c29SRuslan Bukin case pte_bad_opc:
4874fe6c29SRuslan Bukin return "unknown opcode";
4974fe6c29SRuslan Bukin
5074fe6c29SRuslan Bukin case pte_bad_packet:
5174fe6c29SRuslan Bukin return "unknown packet";
5274fe6c29SRuslan Bukin
5374fe6c29SRuslan Bukin case pte_bad_context:
5474fe6c29SRuslan Bukin return "unexpected packet context";
5574fe6c29SRuslan Bukin
5674fe6c29SRuslan Bukin case pte_eos:
5774fe6c29SRuslan Bukin return "reached end of trace stream";
5874fe6c29SRuslan Bukin
5974fe6c29SRuslan Bukin case pte_bad_query:
6074fe6c29SRuslan Bukin return "trace stream does not match query";
6174fe6c29SRuslan Bukin
6274fe6c29SRuslan Bukin case pte_nomem:
6374fe6c29SRuslan Bukin return "out of memory";
6474fe6c29SRuslan Bukin
6574fe6c29SRuslan Bukin case pte_bad_config:
6674fe6c29SRuslan Bukin return "bad configuration";
6774fe6c29SRuslan Bukin
6874fe6c29SRuslan Bukin case pte_noip:
6974fe6c29SRuslan Bukin return "no ip";
7074fe6c29SRuslan Bukin
7174fe6c29SRuslan Bukin case pte_ip_suppressed:
7274fe6c29SRuslan Bukin return "ip has been suppressed";
7374fe6c29SRuslan Bukin
7474fe6c29SRuslan Bukin case pte_nomap:
7574fe6c29SRuslan Bukin return "no memory mapped at this address";
7674fe6c29SRuslan Bukin
7774fe6c29SRuslan Bukin case pte_bad_insn:
7874fe6c29SRuslan Bukin return "unknown instruction";
7974fe6c29SRuslan Bukin
8074fe6c29SRuslan Bukin case pte_no_time:
8174fe6c29SRuslan Bukin return "no timing information";
8274fe6c29SRuslan Bukin
8374fe6c29SRuslan Bukin case pte_no_cbr:
8474fe6c29SRuslan Bukin return "no core:bus ratio";
8574fe6c29SRuslan Bukin
8674fe6c29SRuslan Bukin case pte_bad_image:
8774fe6c29SRuslan Bukin return "bad image";
8874fe6c29SRuslan Bukin
8974fe6c29SRuslan Bukin case pte_bad_lock:
9074fe6c29SRuslan Bukin return "locking error";
9174fe6c29SRuslan Bukin
9274fe6c29SRuslan Bukin case pte_not_supported:
9374fe6c29SRuslan Bukin return "not supported";
9474fe6c29SRuslan Bukin
9574fe6c29SRuslan Bukin case pte_retstack_empty:
9674fe6c29SRuslan Bukin return "compressed return without call";
9774fe6c29SRuslan Bukin
9874fe6c29SRuslan Bukin case pte_bad_retcomp:
9974fe6c29SRuslan Bukin return "bad compressed return";
10074fe6c29SRuslan Bukin
10174fe6c29SRuslan Bukin case pte_bad_status_update:
10274fe6c29SRuslan Bukin return "bad status update";
10374fe6c29SRuslan Bukin
10474fe6c29SRuslan Bukin case pte_no_enable:
10574fe6c29SRuslan Bukin return "expected tracing enabled event";
10674fe6c29SRuslan Bukin
10774fe6c29SRuslan Bukin case pte_event_ignored:
10874fe6c29SRuslan Bukin return "event ignored";
10974fe6c29SRuslan Bukin
11074fe6c29SRuslan Bukin case pte_overflow:
11174fe6c29SRuslan Bukin return "overflow";
11274fe6c29SRuslan Bukin
11374fe6c29SRuslan Bukin case pte_bad_file:
11474fe6c29SRuslan Bukin return "bad file";
11574fe6c29SRuslan Bukin
11674fe6c29SRuslan Bukin case pte_bad_cpu:
11774fe6c29SRuslan Bukin return "unknown cpu";
11874fe6c29SRuslan Bukin }
11974fe6c29SRuslan Bukin
12074fe6c29SRuslan Bukin /* Should not reach here. */
12174fe6c29SRuslan Bukin return "internal error.";
12274fe6c29SRuslan Bukin }
123