| 1 | /* |
|---|
| 2 | BuildSymbolTest.c |
|---|
| 3 | |
|---|
| 4 | DHL Test routine series. |
|---|
| 5 | BuildSymbol module test. |
|---|
| 6 | |
|---|
| 7 | Digital STREAM Technology, Inc. |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | #include "DHL_Types.h" |
|---|
| 12 | #include "DHL_BuildSymbol.h" |
|---|
| 13 | |
|---|
| 14 | #include "DHL_OS_DebugIO.h" |
|---|
| 15 | #include "DHL_Console.h" |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | #define printf OS_DbgPrintf |
|---|
| 19 | |
|---|
| 20 | void Symbol_Test(void) |
|---|
| 21 | { |
|---|
| 22 | UINT32 addr, addr2; |
|---|
| 23 | const char *name; |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | printf("\n** %s:\n\n", __func__); |
|---|
| 27 | |
|---|
| 28 | //---------------------------- |
|---|
| 29 | printf("\n** name('%s') -> addr test:\n", __func__); |
|---|
| 30 | |
|---|
| 31 | addr = DHL_DBG_FindSymbolByName(__func__); |
|---|
| 32 | if (addr) |
|---|
| 33 | printf("\t symbol '%s': 0x%x\n", __func__, addr); |
|---|
| 34 | else |
|---|
| 35 | printf("\t !! err\n"); |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | //---------------------------- |
|---|
| 39 | addr2 = addr + 10; |
|---|
| 40 | printf("\n** addr(0x%x) -> name test:\n", addr2); |
|---|
| 41 | |
|---|
| 42 | addr = DHL_DBG_FindSymbolByAddr(addr2, &name); |
|---|
| 43 | |
|---|
| 44 | if (addr) |
|---|
| 45 | printf("\t 0x%x = '%s' + %08x\n", addr2, name, addr2-addr); |
|---|
| 46 | else |
|---|
| 47 | printf("\t !! err\n"); |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | //---------------------------- |
|---|
| 51 | |
|---|
| 52 | while (1) |
|---|
| 53 | { |
|---|
| 54 | char buf[200]; |
|---|
| 55 | int n; |
|---|
| 56 | |
|---|
| 57 | printf("\n type string to search ('x' to exit): "); |
|---|
| 58 | n = DHL_DBG_GetLine(buf, 200, 0); |
|---|
| 59 | |
|---|
| 60 | if (n < 0) continue; |
|---|
| 61 | |
|---|
| 62 | if (strcmp(buf, "x") == 0) break; |
|---|
| 63 | |
|---|
| 64 | printf("\n lookup symbol '%s'..\n", buf); |
|---|
| 65 | DHL_DBG_LookupSymbols(buf); |
|---|
| 66 | } |
|---|
| 67 | printf("\n exit test\n"); |
|---|
| 68 | |
|---|
| 69 | } |
|---|
| 70 | |
|---|