VBCC crash when using GetLocaleStr()

4 posts / 0 new
Last post
jabirulo
jabirulo's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2013-05-30 00:53
VBCC crash when using GetLocaleStr()

Hi, I'm gettign a crash/GR when using GetLocaleStr(),, under GCC everything works ok.
Any hints/ideas?

TiA

GetLocaleStr(fgui->mv->locale,MON_1)

  1. [find_wb.c:598 ] ADVANCED_SEARCH=1
  2. [find_wb.c:606 ] readToolTypes() - END
  3. [find_wb.c:56 ] Started from Workbench
  4. [find_wb.c:59 ] fgui->mv->locale=0x0000600d
  5. 54.56 (26.1.2023) Sam460 release
  6. Machine model: 7 (Sam460ex)
  7. Dump of context at 0xff8587c0
  8. Trap type: DSI exception
  9. Machine State (raw): 0x2f030
  10. Machine State (verbose): [ExtInt on] [User] [FPU on] [IAT on] [DAT on]
  11. Temporary stack trace:
  12. #0: 0x7fff6784
  13. #1: 0x7f64f160
  14. #2: 0x7f646f04
  15. #3: 0x7f646778
  16. #4: 0x7f6463f0
  17. #5: in module Kickstart/kernel+0x54d48 (0x1854d48)
  18. #6: in module Kickstart/kernel+0x54dc0 (0x1854dc0)
  19. #7: 0x0
  20.  
  21. Crashed process: Find_debug (0x58431650)
  22. 0: 7f64f160 536c3dc0 00000000 6ff195b0 0000600d 0000003b 00000000 0222aefc
  23. 8: 00008000 7fffb75c 7fff6744 58430000 24022484 58439a2c 54e9e390 00000000
  24. 16: 00000004 54e9e390 00000000 00000000 0000000a 00000000 54625382 00008000
  25. 24: 00000000 0195557c 58431650 6ffa1170 02119c2c 0000600d 6ff195b0 0000003b
  26. CR: 44022482 XER: 00000002 CTR: 7fffb75c LR: 7f64f160
  27. ESR: 00000000
  28. DEAR: 000060c9
  29. mcsrr0: 0x0
  30. csrr0: 0x0
  31.  
  32. Disassembly of crash site:
  33. 7fff6774: 7cbf2b78 mr r31,r5
  34. 7fff6778: 9361002c stw r27,44(r1)
  35. 7fff677c: 7d2903a6 mtctr r9
  36. 7fff6780: 93810030 stw r28,48(r1)
  37. >7fff6784: 808400bc lwz r4,188(r4)
  38. 7fff6788: 4e800421 bctrl
  39. 7fff678c: 2c030000 cmpwi r3,0
  40. 7fff6790: 41c200a4 beq- 0x7FFF6834
  41. 7fff6794: 393fffcc subi r9,r31,52
  42. 7fff6798: 2b890012 cmplwi cr7,r9,18
  43. Fault caused by load operation
  44.  
  45. Kernel command line: debuglevel=4 SERIAL MUNGE
  46.  
  47. Registers pointing to code:
  48. r0 : module Find_debug at 0x7F64F160 (section 0 @ 0x913C)
  49. r7 : native kernel module Kickstart/kernel+0x00a2aefc
  50. r9 : module LIBS:locale.library at 0x7FFFB75C (section 0 @ 0x8738)
  51. r10: module LIBS:locale.library at 0x7FFF6744 (section 0 @ 0x3720)
  52. r25: native kernel module Kickstart/dos.library.kmod+0x0002b05c
  53. r28: native kernel module Kickstart/kernel+0x00919c2c
  54. ip : module LIBS:locale.library at 0x7FFF6784 (section 0 @ 0x3760)
  55. lr : module Find_debug at 0x7F64F160 (section 0 @ 0x913C)
  56. ctr: module LIBS:locale.library at 0x7FFFB75C (section 0 @ 0x8738)
  57.  
  58. Stack trace:
  59. (0x536c3dc0) module LIBS:locale.library at 0x7FFF6784 (section 0 @ 0x3760)
  60. (0x536c3e00) module Find_debug at 0x7F64F160 (section 0 @ 0x913C)
  61. (0x536c3e60) module Find_debug at 0x7F646F04 (section 0 @ 0xEE0)
  62. (0x536c3ee0) module Find_debug at 0x7F646778 (section 0 @ 0x754)
  63. (0x536c3f00) Find_debug:_start()+0x3f0 (section 1 @ 0x3EC)
  64. (0x536c3fc0) native kernel module Kickstart/kernel+0x00054d48
  65. (0x536c3fd0) native kernel module Kickstart/kernel+0x00054dc0
  66.  
  67. Disassembly of crash site:
  68. 7fff6774: 7cbf2b78 mr r31,r5
  69. 7fff6778: 9361002c stw r27,44(r1)
  70. 7fff677c: 7d2903a6 mtctr r9
  71. 7fff6780: 93810030 stw r28,48(r1)
  72. >7fff6784: 808400bc lwz r4,188(r4)
  73. 7fff6788: 4e800421 bctrl
  74. 7fff678c: 2c030000 cmpwi r3,0
  75. 7fff6790: 41c200a4 beq- 0x7FFF6834
  76. 7fff6794: 393fffcc subi r9,r31,52
  77. 7fff6798: 2b890012 cmplwi cr7,r9,18
  78. Stack pointer (0x536c3dc0) is inside bounds
  79. Redzone is OK (4)
  80. ...
jabirulo
jabirulo's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2013-05-30 00:53
Re: VBCC crash when using GetLocaleStr()

Noticed one thin with VBCC:

  1. [findgui.c:91 ] *****Find START*****
  2. [findgui.c:97 ] WBenchMsg=0x52300c52
  3. [findgui.c:243 ] OpenLibs()
  4. [findgui.c:117 ] mv->locale=0x600da9a0
  5. [findgui.c:133 ] fgui = 0x53c1e760 (mv=0x5e2489a0)
  6. [findgui.c:153 ] 0x5e2489a0 == 0x5e2489a0
  7. [find_wb.c:549 ] readToolTypes() - START
  8. [find_wb.c:560 ] TOOLBARBORDERLESS=0x00000000
  9. [find_wb.c:569 ] TOOLBARSTYLE=0x00000000
  10. [find_wb.c:577 ] GUIIMAGES='PROGDIR:images'
  11. [find_wb.c:583 ] CASESENS_NAME=0
  12. [find_wb.c:585 ] CASESENS_COMMENT=0
  13. [find_wb.c:587 ] CASESENS_CONTAINS=0
  14. [find_wb.c:590 ] SUBSTRING_FILENAME=1
  15. [find_wb.c:593 ] SKIP_ICONS=0
  16. [find_wb.c:595 ] FOLLOW_LINKS=1
  17. [find_wb.c:598 ] ADVANCED_SEARCH=1
  18. [find_wb.c:606 ] readToolTypes() - END
  19. [find_wb.c:56 ] Started from Workbench
  20. [find_wb.c:59 ] fgui->mv->locale=0x0000600d
  21. 54.56 (26.1.2023) Sam460 release
  22. ...

With VBCC mv->locale=0x600da9a0 != fgui->mv->locale=0x0000600d (then crashes)
while with GCC mv->locale=0x600da9a0 == fgui->mv->locale=0x600da9a0

struct FindGUI {
Object *Objects[GID_LAST]; // gadgets/objects
...
struct List *fgui_MM_list;
struct MainVars *mv; // part of Find.c/Find.h by Constantinos Nicolakakis
...
};

struct FindGUI *fgui = AllocVecTags(sizeof(struct FindGUI), AVT_ClearWithValue,NULL, TAG_DONE);
struct MainVars *mv=NULL;
...
fgui->mv = mv; // "points" to struct MainVars
...

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

thomas
thomas's picture
Offline
Last seen: 4 hours 54 min ago
Joined: 2011-05-16 14:23
Re: VBCC crash when using GetLocaleStr()

Looks like an alignment issue. Apparently the code which writes ->locale was aligned to 32 bits while the code which reads it expects alginment to 16 bits.

You should surround the definition of struct MainVars with the right alignment instructions. I don't remember it now, but I think it is #pragma pack(number-of-bytes). You can look into libraries/asl.h for an example.

jabirulo
jabirulo's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2013-05-30 00:53
Re: VBCC crash when using GetLocaleStr()

@thomas

THXaLOT solved, I wasn't "setting" such parameters in one of the headers (the one that declares MainVars)

added
#ifdef __GNUC__
#ifdef __PPC__
#pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif

and now VBCC build works ok too.

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

Log in or register to post comments