Skip to content

GDB: Extended functionality - #965

Merged
jajanusz merged 11 commits into
thesofproject:masterfrom
mrajwa:gdb_support
Apr 8, 2019
Merged

GDB: Extended functionality#965
jajanusz merged 11 commits into
thesofproject:masterfrom
mrajwa:gdb_support

Conversation

@mrajwa

@mrajwa mrajwa commented Feb 5, 2019

Copy link
Copy Markdown
Contributor

Added support for following packets:

  • breakpoint insert
  • breakpoint remove
  • single step in code
  • read/write registers
    read/write memory

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general only the generic GDB code should exist in src/gdb. Anything that is xtensa specific (either C or assembler) must be in arch/xtensa/gdb and use a arch_gdb_ call prefix. This then makes the GDB code easily portable to other DSP architectures e.g ARM M4, Ceva Teaklite since only the arch_gdb_ APIs need to be implemented.

Comment thread src/gdb/gdb.c Outdated
Comment thread src/gdb/gdb.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation looks wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I moved whole while loop max to the left on purpose - we have many switches which are sitting inside another switches and these switches are inside while loop, there are of cource ifs all around... so to meet the 80 characters MAX limit I would have to slice each line (it for sure won't improve code readability). Also keep in mind that after the move of xtensa specific stuff into arch/xtensa/gdb our write_sr function has become arch_gdb_write_sr(arg1, arg2); - it alone took 30 characters!
So the bottom line is, I would sacrifice this while(1){ indentation in this case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgirdwood @mrajwa
Move loop body to another function (may be static inline if you care about call performance penalty), then you'll keep indent of that part

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho still unresolved. Please change it.

Comment thread src/gdb/gdb.c Outdated
Comment thread src/gdb/gdb.c Outdated
Comment thread src/include/sof/gdb/gdb.h Outdated
Comment thread src/gdb/gdb.c Outdated
Comment thread src/gdb/gdb.c Outdated
@dbaluta

dbaluta commented Feb 6, 2019

Copy link
Copy Markdown
Collaborator

@mrajwa few general comments:

  1. https://chris.beams.io/posts/git-commit/#end
  2. https://chris.beams.io/posts/git-commit/#imperative
  3. no need to write all caps for the commit message tag.

So, for example:

GDB: Added support for insert breakpoint.

should be

gdb: Add support for insert breakpoint

Comment thread src/gdb/gdb.c Outdated
@mrajwa

mrajwa commented Feb 13, 2019

Copy link
Copy Markdown
Contributor Author

@lgirdwood changes have been applied. Once this PR is merged people may use GDB.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some minor issues but can you squash the review comments into the earlier patches in this PR. Look forward to using GDB !

Comment thread src/gdb/gdb.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional or can it be removed ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed and actually was in "cleanup" commit.

Comment thread src/gdb/gdb.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"out of scope" is a more meaningful message if its correct ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is, however the error message must contain only HEX characters 0..F otherwise it may cause GDB to close the session.

Comment thread src/include/sof/gdb/gdb.h Outdated
Comment thread src/gdb/gdb.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some magic numbers here that I dont know what they mean. Can we use macros

Comment thread src/gdb/gdb.c Outdated
@plbossart

Copy link
Copy Markdown
Member

@lgirdwood should this be in 1.3?

@lgirdwood

Copy link
Copy Markdown
Member

@mrajwa @michalgrodzicki we could do with this in 1.3, this would let the kernel guys add driver support. @cujomalainey already has some example kernel code but we need this to complete integration.

@lgirdwood lgirdwood added this to the 1.3 milestone Mar 29, 2019
@lgirdwood

Copy link
Copy Markdown
Member

@mrajwa @michalgrodzicki ping, this is very close to merge now. Can we get it to the finish line for 1.3 this week ?

@cujomalainey

cujomalainey commented Apr 1, 2019

Copy link
Copy Markdown
Contributor

Here is the archived repo https://github.com/cujomalainey/cros-kernel
This is pre-github days for SOF and this is running a 4.4 kernel (i think?)
It is also an experiment so just be aware, but basically I modified a virtual tty loopback to use the audio driver and then that connected to the firmware.

@mrajwa

mrajwa commented Apr 1, 2019

Copy link
Copy Markdown
Contributor Author

@lgirdwood, sure I will update soon.

@lgirdwood

Copy link
Copy Markdown
Member

@cujomalainey thanks. @plbossart @ranj063 see comment above for kernel GDB tunnel code. This will need integration into sof-dev kernel branch.

mrajwa added 10 commits April 2, 2019 23:09
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
@mrajwa

mrajwa commented Apr 2, 2019

Copy link
Copy Markdown
Contributor Author

@lgirdwood, update have been pushed, is there anything that you would still like to change/correct before merging it to master?

PS: I do work with @ranj063 on preparing driver daemon for it.

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is good but is still not portable. All xtensa specific code and macros need to be out of src/gdb/.

Comment thread src/gdb/gdb.c Outdated

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrajwa I think I was looking at old/stale commits about 2 hours ? Which is a little confusing. The new update had less patches and were portable.

@mrajwa

mrajwa commented Apr 3, 2019

Copy link
Copy Markdown
Contributor Author

@lgirdwood I don't know. I made the update yesterday once and from that time haven't touched it. Also, the number of commits is exactly the same as it was before my yesterday update.
Anyway, if it is fine for you now lets merge it :)

@lgirdwood

Copy link
Copy Markdown
Member

@mrajwa CI reporting an issue plus we need 2 approvers now before merge.@jajanusz @tlauda can you guys review.

Comment thread src/gdb/gdb.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imho still unresolved. Please change it.

@mrajwa

mrajwa commented Apr 4, 2019

Copy link
Copy Markdown
Contributor Author

@lgirdwood, its passing now, looks like temporary CI problem.
@jajanusz, ok.

@mrajwa

mrajwa commented Apr 4, 2019

Copy link
Copy Markdown
Contributor Author

@jajanusz @lgirdwood updated.

Comment thread src/gdb/gdb.c Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ret is always 1 here, no need to introduce new variable

@mrajwa

mrajwa commented Apr 5, 2019

Copy link
Copy Markdown
Contributor Author

@jajanusz updated.

@jajanusz

jajanusz commented Apr 5, 2019

Copy link
Copy Markdown
Contributor

Weird that compiler didn't complain that there are exectution path without return value

@jajanusz

jajanusz commented Apr 5, 2019

Copy link
Copy Markdown
Contributor

I just realized that you can do anything with GDB and it will pass CI because we don't test configs with CONFIG_GDB ...

@jajanusz
jajanusz self-requested a review April 5, 2019 10:27
@mrajwa

mrajwa commented Apr 5, 2019

Copy link
Copy Markdown
Contributor Author

Seems to be OK now, @tlauda can you put your comment to?

@lgirdwood

Copy link
Copy Markdown
Member

@mrajwa looks like we are waiting on CI completion too.

Comment thread src/arch/xtensa/gdb/CMakeLists.txt Outdated
Signed-off-by: Marcin Rajwa <marcin.rajwa@linux.intel.com>
@lgirdwood

Copy link
Copy Markdown
Member

@zrombel CI not running ?

@jajanusz

jajanusz commented Apr 8, 2019

Copy link
Copy Markdown
Contributor

@zrombel CI not running ?

It's running but queue is long, as always on mondays

@jajanusz
jajanusz merged commit 18d116b into thesofproject:master Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants