User forums > Using Code::Blocks
Need help displaying data in assembly language
oBFusCATed:
OK, this is the command used by the examine memory feature.
But what about the labels and other stuff you mention?
Edit:
I would be happy if you give me an example file, which can be compiled with gcc or something easily available on linux,
and all the commands you want to be able to automate using an IDE like C::B.
Ray Seyfarth:
--- Quote from: oBFusCATed on December 06, 2011, 10:48:21 pm ---OK, this is the command used by the examine memory feature.
But what about the labels and other stuff you mention?
Edit:
I would be happy if you give me an example file, which can be compiled with gcc or something easily available on linux,
and all the commands you want to be able to automate using an IDE like C::B.
--- End quote ---
I would envision a form which lets me provide the label, address, type, and count. It would be outstanding if such a collection could hang around throughout the session or even between sessions. Allocated memory tends to have the same addresses, so retained watches (or displays) would work pretty well. If I am permitted to dream big, it would also be nice to be able to dump memory from a register as an address. This would help with local variables which are on the stack.
My only purpose is in teaching assembly language. Ultimately it would be nice to extend nasm with the equivalent to C declarations for parameters and local variables for functions. This would probably require more work and the simplicity of just having a labelled and typed memory dump would be quite an improvement over teaching students to use the examine command. Plus the examine command had to be re-entered. I've experimented with gdbtui and cgdb, but CB is pretty close. I could probably figure out how to adapt CB myself, though I expect that someone else is already prepared to adapt CB and could do it at least 10 times as fast as I would.
I can provide some code if really needed, but the functionality is essentially the examine command implemented in a GUI with data refreshed each time the debugger is ready for a new command. I have been doing assembly coding, so I can provide an assembly example. I could provide a C example but the feature is basically not needed in C since the type information is provided by the compiler.
Are you interested in a program which reads the degree of a polynomial, reads the coefficients, reads two numbers, a and b, allocates arrays for the polynomial, its derivative and its integral and computes some polynomial values? This is the most interesting example which would benefit greatly from being able to display the 3 allocated arrays while the code reads and operates on the arrays.
Thanks for your interest. It's beginning to sound like I won't have to study the CB code ;-)
Ray
oBFusCATed:
I have some interest to improve the examine memory window (it won't happen now, but I'll add it to my todo).
So, a C example with all the possible commands will be useful.
Sometimes the examine memory window is needed even, when coding in C/C++.
An example is packing data in a buffer to be saved in a file or send on the network.
I doubt, I'll invest any time in implementing the labeling stuff.
Because no one is doing active development in asm these days.
Ray Seyfarth:
--- Quote from: oBFusCATed on December 06, 2011, 11:53:24 pm ---I have some interest to improve the examine memory window (it won't happen now, but I'll add it to my todo).
So, a C example with all the possible commands will be useful.
Sometimes the examine memory window is needed even, when coding in C/C++.
An example is packing data in a buffer to be saved in a file or send on the network.
I doubt, I'll invest any time in implementing the labeling stuff.
Because no one is doing active development in asm these days.
--- End quote ---
Even in C/C++ it can be handy to give names to areas of memory. This is more critical if there is more than 1 such area. I can imagine that there might be cases when you might not have a local or global variable giving convenient access to an array of data. The data could be accessible through a moderate amount of indirection and giving convenient access would be nice. It would also be nice to allow naming these arrays or variables in case someone needs to track multiple variables. It should be a minor matter to add names to the new capability if done at the time it is created.
On another note I noticed some python code within the CB source code and discovered that the latest versions of gdb support python coding. I am a little rusty on python, but I am preparing a define-variable and print-variable pair of commands to allow the user to develop a crude symbol table. So far I am somewhat successful with reviving some python skills and have the commands saving variable data in a python dictionary. I can see that I need to do some parameter checking next to force reasonable data for the dictionary data. This will work well for my uses within gdb.
I have written an assembly book which I hope to update by next fall with better debugging capabilities. It would be nice to include CB as an IDE for developing yasm code in the book for next fall's class. Students had some difficulties coping well with gdb. I am sure I can at least minimize the pain of using gdb directly, though I hope I can get CB up to speed.
I agree with you assessment that few people develop in assembly. There are only a few who do this for high efficiency. The purpose for my class is simply for the students to get a firmer grasp on what C/C++ does with high level code. I don't think any of my students is likely to write any code which is more efficient that g++. It is hard to beat g++.
Thanks again for your interest.
Ray
oBFusCATed:
--- Quote from: Ray Seyfarth on December 07, 2011, 04:55:57 pm ---Even in C/C++ it can be handy to give names to areas of memory. This is more critical if there is more than 1 such area. I can imagine that there might be cases when you might not have a local or global variable giving convenient access to an array of data. The data could be accessible through a moderate amount of indirection and giving convenient access would be nice. It would also be nice to allow naming these arrays or variables in case someone needs to track multiple variables. It should be a minor matter to add names to the new capability if done at the time it is created.
--- End quote ---
I don't understand how this is related to C/C++.
Still waiting for the c/c++ and gdb commands, btw.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version