News for hackers. Stuff that matters.
Re:Learning C with gdb by stonefroot on Monday August 27, 2012 @02:39PM (#4440155)
I want to be able to do this with assembly, e.g., see what is in each register as I step through the program.
Re:Learning C with gdb by duaneb on Monday August 27, 2012 @02:53PM (#4440210)
GDB can step through instruction by instruction, and you can easily examine registers.
Re:Learning C with gdb by stonefroot on Monday August 27, 2012 @03:14PM (#4440309)
Can I do this with a hand-written assembly program, i.e. not necessarily one that has been compiled with as and subject to GNU default optimisations or "constraints"?
Re:Learning C with gdb by cfallin on Monday August 27, 2012 @04:17PM (#4440639)
The commands you want are "stepi" (single-step one instruction), "disass" (disassemble at the current point in the program), and "info registers" (show you what's in all of the registers). These work equally well for hand-written assembly and for any arbitrary compiled program.
Re:Learning C with gdb by stonefroot on Monday August 27, 2012 @04:33PM (#4440729)
cfallin: many, many thanks.

I guess should read the gdb manual, and, if it's anything like the as manual (which I've learned is not always the full story), the source too.

Re:Learning C with gdb by duaneb on Monday August 27, 2012 @03:40PM (#4440440)
It's been many years since i've done hand-written assembly, so I can't say for sure, but it should be able to do instruction stepping on arbitrary programs.
Re:Learning C with gdb by tene on Monday August 27, 2012 @04:07PM (#4440585)
Yes.
Re:Learning C with gdb by jfaucett on Monday August 27, 2012 @02:53PM (#4440213)
like digitalinfinity says info registers should be what your looking for. Here's the docs: http://www.ofb.net/gnu/gdb/gdb_61.html
Re:Learning C with gdb by prattmic on Monday August 27, 2012 @11:40PM (#4442011)
You can use "layout asm" to see the dissassembly as you step through your program. "layout reg" will then split the view and show you the registers at the same time.
Re:Learning C with gdb by digitalinfinity on Monday August 27, 2012 @02:46PM (#4440186)
Doesn't info registers in gdb do this for you?