| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bdbg_output.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/12 $ |
|---|
| 12 | * $brcm_Date: 2/21/12 1:59p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/dbg/bdbg_output.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/12 2/21/12 1:59p erickson |
|---|
| 21 | * SW7425-2130: add new DBG options for compact debug mode |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/11 8/4/11 8:03p vsilyaev |
|---|
| 24 | * SW7420-1465: Removed dead code |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/10 8/3/11 5:33p vsilyaev |
|---|
| 27 | * SW7420-1465, SW7405-5221: Route debug output to the special FIFO |
|---|
| 28 | * instead of syslog buffer |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/9 6/8/11 2:14p vsilyaev |
|---|
| 31 | * SW7405-4477: Added missing new line |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/8 6/6/11 3:27p vsilyaev |
|---|
| 34 | * SW7405-4477: Routed all debug output through buffer and use external |
|---|
| 35 | * application to extract and print debug output |
|---|
| 36 | * |
|---|
| 37 | * Hydra_Software_Devel/7 4/13/11 7:00p vsilyaev |
|---|
| 38 | * SW7405-5221: Route BERR_TRACE through the debug log |
|---|
| 39 | * |
|---|
| 40 | * Hydra_Software_Devel/6 8/15/07 2:25p vsilyaev |
|---|
| 41 | * PR 34089: Optimized executuion speed and code size |
|---|
| 42 | * |
|---|
| 43 | * Hydra_Software_Devel/5 1/16/07 3:15p erickson |
|---|
| 44 | * PR27092: prepend <0> to get message out of linux kernel before dying |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/4 7/25/06 10:42a vsilyaev |
|---|
| 47 | * PR 22695: Pulled the debug output routines into the release build |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/3 10/8/04 10:28a pntruong |
|---|
| 50 | * PR12728: Fixed -pdantic build warnings and errors. |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/2 3/28/03 5:58p vsilyaev |
|---|
| 53 | * Added BDBG_P_PrintError and BDGB_P_AssertFailed. |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/1 3/12/03 2:38p vsilyaev |
|---|
| 56 | * Default debug output file. |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/1 3/10/03 9:48a vsilyaev |
|---|
| 59 | * Win32 implementation of the O/S specific debug interface functions. |
|---|
| 60 | * |
|---|
| 61 | ***************************************************************************/ |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | #include "bstd.h" |
|---|
| 65 | #include "bkni.h" |
|---|
| 66 | #include "bdbg_priv.h" |
|---|
| 67 | |
|---|
| 68 | void |
|---|
| 69 | BDBG_P_AssertFailed(const char *expr, const char *file, unsigned line) |
|---|
| 70 | { |
|---|
| 71 | #if B_REFSW_DEBUG_COMPACT_ERR |
|---|
| 72 | BSTD_UNUSED(expr); |
|---|
| 73 | BDBG_P_PrintString("!!! Assert at %s:%d\n", file, line); |
|---|
| 74 | #else |
|---|
| 75 | BDBG_P_PrintString("!!! Assert '%s' Failed at %s:%d\n", expr, file, line); |
|---|
| 76 | #endif |
|---|
| 77 | #if !B_REFSW_DEBUG_ASSERT_NO_FAIL |
|---|
| 78 | BKNI_Fail(); |
|---|
| 79 | #endif |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | BERR_Code |
|---|
| 83 | BDBG_P_PrintError(const char *file, unsigned lineno, const char *error, BERR_Code error_no) |
|---|
| 84 | { |
|---|
| 85 | if (error_no != BERR_SUCCESS) { |
|---|
| 86 | #if B_REFSW_DEBUG_COMPACT_ERR |
|---|
| 87 | BSTD_UNUSED(error); |
|---|
| 88 | BDBG_P_PrintString("!!!Error at %s:%d\n", file, lineno); |
|---|
| 89 | #else |
|---|
| 90 | BDBG_P_PrintString("!!!Error %s(%#x) at %s:%d\n", error, error_no, file, lineno); |
|---|
| 91 | #endif |
|---|
| 92 | } |
|---|
| 93 | return error_no; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | int |
|---|
| 97 | BDBG_P_Vprintf(const char *fmt, va_list ap) |
|---|
| 98 | { |
|---|
| 99 | return BDBG_P_Vprintf_Log(BDBG_ModulePrintKind_eString, fmt, ap); |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | void |
|---|
| 103 | BDBG_P_PrintString(const char *fmt, ...) |
|---|
| 104 | { |
|---|
| 105 | va_list ap; |
|---|
| 106 | |
|---|
| 107 | va_start(ap, fmt); |
|---|
| 108 | |
|---|
| 109 | BDBG_P_Vprintf(fmt, ap); |
|---|
| 110 | |
|---|
| 111 | va_end( ap ); |
|---|
| 112 | |
|---|
| 113 | return; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | /* End of file */ |
|---|