Debugging With an Orange Bang
|
06-29-2017, 02:58 AM
Post: #1
|
|||
|
|||
Debugging With an Orange Bang
I have a program that checks OK but when I go to run it, all I get is an orange circle with a bang (exclamation point) in it. I can't even run the debugger without getting the bang. How am I supposed to debug that? A more informative error message would be appreciated.
Code: #cas Tom L Cui bono? |
|||
06-29-2017, 12:01 PM
Post: #2
|
|||
|
|||
RE: Debugging With an Orange Bang
If you run it with the debugger, the cursor should be placed on the offending instruction (after you get the bang).
|
|||
06-30-2017, 05:15 AM
Post: #3
|
|||
|
|||
RE: Debugging With an Orange Bang
Hello,
Your program is a CAS program and unfortunately, the debuger does not really work with the CAS... now, as it turns out, your program, as far as I can tell, does not really need the CAS, so you should be able to remove the #cas at the top and easily transform said program in a home program. At that point, the debugger WILL work and you will be able to find the issue. Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. |
|||
06-30-2017, 10:24 AM
Post: #4
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-30-2017 05:15 AM)cyrille de brébisson Wrote: Hello, You mean I can use =< to modify an array by reference in a non-CAS program? I tried that but get a syntax error at that line. I'll keep experimenting. Tom L Cui bono? |
|||
06-30-2017, 11:50 AM
Post: #5
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-29-2017 12:01 PM)webmasterpdx Wrote: If you run it with the debugger, the cursor should be placed on the offending instruction (after you get the bang). Thank for the reply. The cursor is put at the beginning of the first line "#cas" That doesn't seem very helpful to me. Tom L Cui bono? |
|||
06-30-2017, 11:56 AM
(This post was last modified: 06-30-2017 11:57 AM by Didier Lachieze.)
Post: #6
|
|||
|
|||
RE: Debugging With an Orange Bang
I've slightly modified your program and I've got a working version:
Code: #cas Code: circl(); The full code: Code: circl(); (06-30-2017 10:24 AM)toml_12953 Wrote: You mean I can use =< to modify an array by reference in a non-CAS program? I tried that but get a syntax error at that line. I'll keep experimenting. Now I'm wondering why you use =< here as it works as well with := instead of =< in the lines: Code: c(x) =< 0.5 * m12 / m11; // center of circle |
|||
06-30-2017, 12:26 PM
Post: #7
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-30-2017 11:56 AM)Didier Lachieze Wrote: Now I'm wondering why you use =< here as it works as well with := instead of =< in the lines: In order for that to work, c has to either be global or be passed by reference. Otherwise modifying the values in c in the function circl won't modify the values in the main program. At least that's what I've found in regular programs. Maybe in CAS programs it's different? If so, I'll be making most of my programs CAS from now on. Thanks for your time and expertise on this! Tom L Cui bono? |
|||
06-30-2017, 12:33 PM
(This post was last modified: 06-30-2017 12:54 PM by toml_12953.)
Post: #8
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-30-2017 11:56 AM)Didier Lachieze Wrote: I've slightly modified your program and I've got a working version: I tried the following but c never gets modified in the main program: Code: circl(); Run shows: points: (7, 7), (0, 8), (0, 0) Not a circle! [/code] When I debug it, it seems like circl never gets called. Step skips right over the call to circl. Tom L Cui bono? |
|||
06-30-2017, 01:14 PM
Post: #9
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-30-2017 12:26 PM)toml_12953 Wrote:(06-30-2017 11:56 AM)Didier Lachieze Wrote: Now I'm wondering why you use =< here as it works as well with := instead of =< in the lines: Ok, I understand now what you're trying to do. But when you call circl with: circl(c,p) the parameters are not passed by reference as described for the xcas functions: "It is not possible to pass arguments by reference, only by value." I don't think it is different on the Prime. So circl get a copy of c and whatever you do on it with := or =< , this will not change the value of c in the main program. At least this is how I understand it. You can have c declared as a global variable but in this case it should not be a parameter of circl and then whatever change is done in circl will be visible to the main program but there is no need to use =< for that. |
|||
06-30-2017, 01:38 PM
Post: #10
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-30-2017 01:14 PM)Didier Lachieze Wrote:(06-30-2017 12:26 PM)toml_12953 Wrote: In order for that to work, c has to either be global or be passed by reference. Otherwise modifying the values in c in the function circl won't modify the values in the main program. At least that's what I've found in regular programs. Maybe in CAS programs it's different? If so, I'll be making most of my programs CAS from now on. Thanks for your time and expertise on this! My original program worked and did use c as a global array but I was hoping to eliminate that with =<. So what is the point of =< as opposed to := ? I thought =< was supposed to modify by reference. If it doesn't, I really don't see the utility of it. Tom L Cui bono? |
|||
06-30-2017, 05:22 PM
Post: #11
|
|||
|
|||
RE: Debugging With an Orange Bang
Couldn't you just make c a local variable? Like this:
Code: LOCAL DoSomeStuff(); -road |
|||
06-30-2017, 05:56 PM
Post: #12
|
|||
|
|||
RE: Debugging With an Orange Bang
(06-30-2017 05:22 PM)roadrunner Wrote: Couldn't you just make c a local variable? Like this: Huh. I thought a variable outside the EXPORT begin-end block had to be global. Your suggestion makes them semi-global - Global to all routines in this program but not seen by other programs. I have so much to learn! That's why I have so much fun with these machines. I learn so much. Thanks for your input! Tom L Cui bono? |
|||
06-30-2017, 09:12 PM
Post: #13
|
|||
|
|||
RE: Debugging With an Orange Bang
You don't need to put the LOCAL there either (it is optional ouside of a function scope). Any variable declared outside the scope will be one of these "local to the file" variables that don't appear outside the system except for full qualification.
TW Although I work for HP, the views and opinions I post here are my own. |
|||
07-01-2017, 10:55 PM
Post: #14
|
|||
|
|||
RE: Debugging With an Orange Bang
If the debugger is on the #CAS instruction when you get the fault, then it could be that you are missing a matching END; statement, or you have to be in CAS mode to run it. I think if you want to run it in home mode, you need to use EXPORT instead of #cas.....
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)